mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-01-12 16:15:17 +00:00
31 lines
817 B
Rust
31 lines
817 B
Rust
#![allow(dead_code)]
|
|
|
|
use jsonrpsee::core::Error;
|
|
use jsonrpsee::types::error::{CallError, ErrorCode, ErrorObject};
|
|
|
|
pub fn not_supported() -> Error {
|
|
Error::Call(CallError::Custom(ErrorObject::borrowed(
|
|
ErrorCode::MethodNotFound.code(),
|
|
&"Not supported",
|
|
None,
|
|
)))
|
|
}
|
|
|
|
pub fn internal_error(msg: impl std::convert::AsRef<str>) -> Error {
|
|
Error::Call(CallError::Custom(ErrorObject::owned(
|
|
ErrorCode::InternalError.code(),
|
|
"Internal error",
|
|
Some(msg.as_ref()),
|
|
)))
|
|
}
|
|
|
|
pub fn invalid_params(param: &str, msg: impl std::convert::AsRef<str>) -> Error {
|
|
let error = &format!("Invalid params: {:}", param);
|
|
|
|
Error::Call(CallError::Custom(ErrorObject::owned(
|
|
ErrorCode::InvalidParams.code(),
|
|
error,
|
|
Some(msg.as_ref()),
|
|
)))
|
|
}
|