Skip to content

Commit

Permalink
Change error type (#92)
Browse files Browse the repository at this point in the history
* minor error coversion change

* make clippy happy
  • Loading branch information
linuskendall authored Jul 27, 2023
1 parent 3ca1303 commit 3d17924
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions das_api/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use {jsonrpsee::core::Error as RpcError, jsonrpsee::types::error::CallError, thiserror::Error};

#[allow(clippy::enum_variant_names)]
#[derive(Error, Debug)]
pub enum DasApiError {
#[error("Config Missing or Error {0}")]
Expand All @@ -22,9 +23,10 @@ pub enum DasApiError {
DeserializationError(#[from] serde_json::Error),
}

impl Into<RpcError> for DasApiError {
fn into(self) -> RpcError {
println!("{}", self);
RpcError::Call(CallError::from_std_error(self))

impl From<DasApiError> for RpcError {
fn from(value: DasApiError) -> Self {
println!("{}", value);
RpcError::Call(CallError::from_std_error(value))
}
}

0 comments on commit 3d17924

Please sign in to comment.