Merge branch 'master' into lightrpc

This commit is contained in:
Robert Habermeier
2017-02-20 18:01:29 +01:00
181 changed files with 7675 additions and 901 deletions

View File

@@ -46,10 +46,10 @@ mod codes {
pub const REQUEST_REJECTED: i64 = -32040;
pub const REQUEST_REJECTED_LIMIT: i64 = -32041;
pub const REQUEST_NOT_FOUND: i64 = -32042;
pub const COMPILATION_ERROR: i64 = -32050;
pub const ENCRYPTION_ERROR: i64 = -32055;
pub const FETCH_ERROR: i64 = -32060;
pub const NO_LIGHT_PEERS: i64 = -32065;
pub const DEPRECATED: i64 = -32070;
}
pub fn unimplemented(details: Option<String>) -> Error {
@@ -100,14 +100,6 @@ pub fn account<T: fmt::Debug>(error: &str, details: T) -> Error {
}
}
pub fn compilation<T: fmt::Debug>(error: T) -> Error {
Error {
code: ErrorCode::ServerError(codes::COMPILATION_ERROR),
message: "Error while compiling code.".into(),
data: Some(Value::String(format!("{:?}", error))),
}
}
pub fn internal<T: fmt::Debug>(error: &str, data: T) -> Error {
Error {
code: ErrorCode::InternalError,
@@ -325,3 +317,11 @@ pub fn no_light_peers() -> Error {
data: None,
}
}
pub fn deprecated<T: Into<Option<String>>>(message: T) -> Error {
Error {
code: ErrorCode::ServerError(codes::DEPRECATED),
message: "Method deprecated".into(),
data: message.into().map(Value::String),
}
}