pretty print errors
This commit is contained in:
parent
9dd0bae40a
commit
6deeabe1e1
@ -236,7 +236,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::Database(err) => {
|
Self::Database(err) => {
|
||||||
error!("database err={:?}", err);
|
error!("database err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -247,7 +247,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::Contract(err) => {
|
Self::Contract(err) => {
|
||||||
warn!("Contract Error: {}", err);
|
warn!("Contract Error: {:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -258,7 +258,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::Decimal(err) => {
|
Self::Decimal(err) => {
|
||||||
debug!("Decimal Error: {}", err);
|
debug!("Decimal Error: {:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::BAD_REQUEST,
|
StatusCode::BAD_REQUEST,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -288,7 +288,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::EthersHttpClient(err) => {
|
Self::EthersHttpClient(err) => {
|
||||||
warn!("EthersHttpClientError err={:?}", err);
|
warn!("EthersHttpClientError err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -299,7 +299,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::EthersProvider(err) => {
|
Self::EthersProvider(err) => {
|
||||||
warn!("EthersProviderError err={:?}", err);
|
warn!("EthersProviderError err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -310,7 +310,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::EthersWsClient(err) => {
|
Self::EthersWsClient(err) => {
|
||||||
warn!("EthersWsClientError err={:?}", err);
|
warn!("EthersWsClientError err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -344,7 +344,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::HdrRecord(err) => {
|
Self::HdrRecord(err) => {
|
||||||
warn!("HdrRecord {:?}", err);
|
warn!("HdrRecord {:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -355,7 +355,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::Headers(err) => {
|
Self::Headers(err) => {
|
||||||
trace!("HeadersError {:?}", err);
|
trace!("HeadersError {:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::BAD_REQUEST,
|
StatusCode::BAD_REQUEST,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -366,7 +366,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::Hyper(err) => {
|
Self::Hyper(err) => {
|
||||||
warn!("hyper err={:?}", err);
|
warn!("hyper err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -379,7 +379,7 @@ impl Web3ProxyError {
|
|||||||
}
|
}
|
||||||
Self::InfluxDb2Request(err) => {
|
Self::InfluxDb2Request(err) => {
|
||||||
// TODO: attach a request id to the message and to this error so that if people report problems, we can dig in sentry to find out more
|
// TODO: attach a request id to the message and to this error so that if people report problems, we can dig in sentry to find out more
|
||||||
error!("influxdb2 err={:?}", err);
|
error!("influxdb2 err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -405,7 +405,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::IpAddrParse(err) => {
|
Self::IpAddrParse(err) => {
|
||||||
debug!("IpAddrParse err={:?}", err);
|
debug!("IpAddrParse err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::BAD_REQUEST,
|
StatusCode::BAD_REQUEST,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -416,7 +416,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::IpNotAllowed(ip) => {
|
Self::IpNotAllowed(ip) => {
|
||||||
trace!("IpNotAllowed ip={})", ip);
|
trace!("IpNotAllowed ip={:#?})", ip);
|
||||||
(
|
(
|
||||||
StatusCode::FORBIDDEN,
|
StatusCode::FORBIDDEN,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -427,7 +427,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::InvalidHeaderValue(err) => {
|
Self::InvalidHeaderValue(err) => {
|
||||||
trace!("InvalidHeaderValue err={:?}", err);
|
trace!("InvalidHeaderValue err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::BAD_REQUEST,
|
StatusCode::BAD_REQUEST,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -460,7 +460,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::Io(err) => {
|
Self::Io(err) => {
|
||||||
warn!("std io err={:?}", err);
|
warn!("std io err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -561,7 +561,7 @@ impl Web3ProxyError {
|
|||||||
(StatusCode::OK, jsonrpc_error_data.clone())
|
(StatusCode::OK, jsonrpc_error_data.clone())
|
||||||
}
|
}
|
||||||
Self::MsgPackEncode(err) => {
|
Self::MsgPackEncode(err) => {
|
||||||
warn!("MsgPackEncode Error: {}", err);
|
warn!("MsgPackEncode Error: {:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -683,7 +683,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::NotImplemented => {
|
Self::NotImplemented => {
|
||||||
trace!("NotImplemented");
|
error!("NotImplemented");
|
||||||
(
|
(
|
||||||
StatusCode::NOT_IMPLEMENTED,
|
StatusCode::NOT_IMPLEMENTED,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -716,7 +716,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::ParseBytesError(err) => {
|
Self::ParseBytesError(err) => {
|
||||||
trace!("ParseBytesError err={:?}", err);
|
trace!("ParseBytesError err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::BAD_REQUEST,
|
StatusCode::BAD_REQUEST,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -727,7 +727,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::ParseMsgError(err) => {
|
Self::ParseMsgError(err) => {
|
||||||
trace!("ParseMsgError err={:?}", err);
|
trace!("ParseMsgError err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::BAD_REQUEST,
|
StatusCode::BAD_REQUEST,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -792,7 +792,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::Redis(err) => {
|
Self::Redis(err) => {
|
||||||
warn!("redis err={:?}", err);
|
warn!("redis err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -825,7 +825,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::SemaphoreAcquireError(err) => {
|
Self::SemaphoreAcquireError(err) => {
|
||||||
warn!("semaphore acquire err={:?}", err);
|
warn!("semaphore acquire err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -837,7 +837,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::SendAppStatError(err) => {
|
Self::SendAppStatError(err) => {
|
||||||
error!("SendAppStatError err={:?}", err);
|
error!("SendAppStatError err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -848,7 +848,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::SerdeJson(err) => {
|
Self::SerdeJson(err) => {
|
||||||
trace!("serde json err={:?} source={:?}", err, err.source());
|
trace!("serde json err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::BAD_REQUEST,
|
StatusCode::BAD_REQUEST,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -862,9 +862,9 @@ impl Web3ProxyError {
|
|||||||
// different status codes should get different error levels. 500s should warn. 400s should stat
|
// different status codes should get different error levels. 500s should warn. 400s should stat
|
||||||
let code = status_code.as_u16();
|
let code = status_code.as_u16();
|
||||||
if (500..600).contains(&code) {
|
if (500..600).contains(&code) {
|
||||||
warn!("server error {} {:?}: {:?}", code, err_msg, err);
|
warn!("server error {} {:?}: {:#?}", code, err_msg, err);
|
||||||
} else {
|
} else {
|
||||||
trace!("user error {} {:?}: {:?}", code, err_msg, err);
|
trace!("user error {} {:?}: {:#?}", code, err_msg, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
(
|
(
|
||||||
@ -962,7 +962,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::VerificationError(err) => {
|
Self::VerificationError(err) => {
|
||||||
trace!("VerificationError err={:?}", err);
|
trace!("VerificationError err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::BAD_REQUEST,
|
StatusCode::BAD_REQUEST,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
@ -973,7 +973,7 @@ impl Web3ProxyError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::WatchRecvError(err) => {
|
Self::WatchRecvError(err) => {
|
||||||
error!("WatchRecvError err={:?}", err);
|
error!("WatchRecvError err={:#?}", err);
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
JsonRpcErrorData {
|
JsonRpcErrorData {
|
||||||
|
Loading…
Reference in New Issue
Block a user