fix: more verbose error strings

This commit is contained in:
əlemi 2024-09-11 17:50:05 +02:00
parent 981e7218b5
commit 314b163b05
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -6,7 +6,7 @@
/// This currently wraps an [http code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status), /// This currently wraps an [http code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status),
/// returned as procedure status. /// returned as procedure status.
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
#[error("server rejected procedure with error code: {0}")] #[error("server rejected procedure with error code: {0:?}")]
pub struct RemoteError(#[from] tonic::Status); pub struct RemoteError(#[from] tonic::Status);
/// Wraps [std::result::Result] with a [RemoteError]. /// Wraps [std::result::Result] with a [RemoteError].
@ -16,11 +16,11 @@ pub type RemoteResult<T> = std::result::Result<T, RemoteError>;
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
pub enum ConnectionError { pub enum ConnectionError {
/// Underlying [`tonic::transport::Error`]. /// Underlying [`tonic::transport::Error`].
#[error("transport error: {0}")] #[error("transport error: {0:?}")]
Transport(#[from] tonic::transport::Error), Transport(#[from] tonic::transport::Error),
/// Error from the remote server, see [`RemoteError`]. /// Error from the remote server, see [`RemoteError`].
#[error("server rejected connection attempt: {0}")] #[error("server rejected connection attempt: {0:?}")]
Remote(#[from] RemoteError), Remote(#[from] RemoteError),
} }