Skip to content

Add error codes to each stratum API #526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2018

Conversation

kakao-jun-e
Copy link
Contributor

Fix #492

The error description has been changed to match the error used in the codechain-core crate and the unused error was deleted.

match self.dispatcher.submit((pow_hash, seal)) {
Ok(()) => {
self.update_peers(&meta.tcp_dispatcher.expect("tcp_dispatcher is always initialized"));
Ok(jsonrpc_core::Value::Bool(true))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It always returns true. Let's change the return type to void.

@@ -526,4 +528,34 @@ mod tests {
.expect("Response should be utf-8");
assert_eq!("{\"jsonrpc\":\"2.0\",\"result\":true,\"id\":2}\n", response);
}

#[test]
fn can_occur_error_for_unauthorized_worker() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returns_error_when_unauthorized_worker_submits

@kakao-jun-e kakao-jun-e force-pushed the release/startum_error branch from 700f3a1 to 87365d5 Compare August 4, 2018 01:46
use jsonrpc_tcp_server::PushMessageError;
use primitives::{Bytes, H256};

#[derive(Debug, Clone)]
pub enum Error {
InternalError,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove Dispatch error message which is no longer used.

@kakao-jun-e kakao-jun-e force-pushed the release/startum_error branch from 87365d5 to f85a72e Compare August 4, 2018 01:51
@kseo kseo merged commit cdb87f0 into CodeChain-io:master Aug 4, 2018
@kakao-jun-e kakao-jun-e deleted the release/startum_error branch August 8, 2018 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants