descriptive text on NotImplemented errors

This commit is contained in:
Bryan Stitt 2023-06-28 21:47:06 -07:00
parent d0e77237fa
commit ebceb0d7d6
4 changed files with 14 additions and 7 deletions

@ -335,7 +335,9 @@ impl Web3ProxyApp {
);
});
} else {
return Err(Web3ProxyError::NotImplemented);
return Err(Web3ProxyError::NotImplemented(
subscribe_to.to_owned().into(),
));
}
// TODO: do something with subscription_join_handle?

@ -11,7 +11,7 @@ use ethers::{
};
use serde_json::json;
use std::sync::Arc;
use tracing::{trace, warn};
use tracing::{trace, warn, error};
use crate::{frontend::authorization::Authorization, rpcs::many::Web3Rpcs};

@ -116,7 +116,8 @@ pub enum Web3ProxyError {
needed: u32,
},
NotFound,
NotImplemented,
#[error(ignore)]
NotImplemented(Cow<'static, str>),
NoVolatileRedisDatabase,
OriginRequired,
#[error(ignore)]
@ -723,12 +724,16 @@ impl Web3ProxyError {
},
)
}
Self::NotImplemented => {
error!("NotImplemented");
Self::NotImplemented(msg) => {
warn!("NotImplemented: {}", msg);
(
StatusCode::NOT_IMPLEMENTED,
JsonRpcErrorData {
message: "work in progress".into(),
message: format!(
"{} is not yet implemented. contact us if you need this",
msg
)
.into(),
code: StatusCode::NOT_IMPLEMENTED.as_u16().into(),
data: None,
},

@ -128,7 +128,7 @@ pub async fn rpc_keys_delete(
let (_user, _semaphore) = app.bearer_is_authorized(bearer).await?;
// TODO: think about how cascading deletes and billing should work
Err(Web3ProxyError::NotImplemented)
Err(Web3ProxyError::NotImplemented("rpc_keys_delete".into()))
}
/// the JSON input to the `rpc_keys_management` handler.