mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-01-18 10:36:23 +00:00
Use alternate error formatting in ToStatus trait impl.
This commit is contained in:
parent
612662cd0b
commit
529e0cfed2
@ -11,39 +11,41 @@ impl ToStatus for storage::error::Error {
|
||||
match self {
|
||||
storage::error::Error::NotFound(_) => Status::new(Code::NotFound, format!("{}", self)),
|
||||
storage::error::Error::AlreadyExists(_) => {
|
||||
Status::new(Code::AlreadyExists, format!("{}", self))
|
||||
Status::new(Code::AlreadyExists, format!("{:#}", self))
|
||||
}
|
||||
storage::error::Error::InvalidEmail => {
|
||||
Status::new(Code::InvalidArgument, format!("{}", self))
|
||||
Status::new(Code::InvalidArgument, format!("{:#}", self))
|
||||
}
|
||||
storage::error::Error::HashPassword(_) => {
|
||||
Status::new(Code::InvalidArgument, format!("{}", self))
|
||||
Status::new(Code::InvalidArgument, format!("{:#}", self))
|
||||
}
|
||||
storage::error::Error::InvalidUsernameOrPassword => {
|
||||
Status::new(Code::Unauthenticated, format!("{}", self))
|
||||
Status::new(Code::Unauthenticated, format!("{:#}", self))
|
||||
}
|
||||
storage::error::Error::InvalidPayload(_) => {
|
||||
Status::new(Code::Internal, format!("{}", self))
|
||||
Status::new(Code::Internal, format!("{:#}", self))
|
||||
}
|
||||
storage::error::Error::InvalidMIC => {
|
||||
Status::new(Code::InvalidArgument, format!("{}", self))
|
||||
Status::new(Code::InvalidArgument, format!("{:#}", self))
|
||||
}
|
||||
storage::error::Error::InvalidDevNonce => {
|
||||
Status::new(Code::InvalidArgument, format!("{}", self))
|
||||
Status::new(Code::InvalidArgument, format!("{:#}", self))
|
||||
}
|
||||
storage::error::Error::Validation(_) => {
|
||||
Status::new(Code::InvalidArgument, format!("{}", self))
|
||||
Status::new(Code::InvalidArgument, format!("{:#}", self))
|
||||
}
|
||||
storage::error::Error::NotAllowed(_) => {
|
||||
Status::new(Code::InvalidArgument, format!("{}", self))
|
||||
Status::new(Code::InvalidArgument, format!("{:#}", self))
|
||||
}
|
||||
storage::error::Error::Diesel(_) => Status::new(Code::Internal, format!("{}", self)),
|
||||
storage::error::Error::Anyhow(_) => Status::new(Code::Internal, format!("{}", self)),
|
||||
storage::error::Error::Lrwn(_) => Status::new(Code::Internal, format!("{}", self)),
|
||||
storage::error::Error::TokioJoin(_) => Status::new(Code::Internal, format!("{}", self)),
|
||||
storage::error::Error::Redis(_) => Status::new(Code::Internal, format!("{}", self)),
|
||||
storage::error::Error::Diesel(_) => Status::new(Code::Internal, format!("{:#}", self)),
|
||||
storage::error::Error::Anyhow(_) => Status::new(Code::Internal, format!("{:#}", self)),
|
||||
storage::error::Error::Lrwn(_) => Status::new(Code::Internal, format!("{:#}", self)),
|
||||
storage::error::Error::TokioJoin(_) => {
|
||||
Status::new(Code::Internal, format!("{:#}", self))
|
||||
}
|
||||
storage::error::Error::Redis(_) => Status::new(Code::Internal, format!("{:#}", self)),
|
||||
storage::error::Error::ProstDecode(_) => {
|
||||
Status::new(Code::Internal, format!("{}", self))
|
||||
Status::new(Code::Internal, format!("{:#}", self))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -51,48 +53,48 @@ impl ToStatus for storage::error::Error {
|
||||
|
||||
impl ToStatus for anyhow::Error {
|
||||
fn status(&self) -> Status {
|
||||
Status::new(Code::Internal, format!("{}", self))
|
||||
Status::new(Code::Internal, format!("{:#}", self))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToStatus for uuid::Error {
|
||||
fn status(&self) -> Status {
|
||||
Status::new(Code::InvalidArgument, format!("{}", self))
|
||||
Status::new(Code::InvalidArgument, format!("{:#}", self))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToStatus for r2d2::Error {
|
||||
fn status(&self) -> Status {
|
||||
Status::new(Code::Internal, format!("{}", self))
|
||||
Status::new(Code::Internal, format!("{:#}", self))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToStatus for lrwn::Error {
|
||||
fn status(&self) -> Status {
|
||||
Status::new(Code::Internal, format!("{}", self))
|
||||
Status::new(Code::Internal, format!("{:#}", self))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToStatus for Box<dyn std::error::Error> {
|
||||
fn status(&self) -> Status {
|
||||
Status::new(Code::Internal, format!("{}", self))
|
||||
Status::new(Code::Internal, format!("{:#}", self))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToStatus for tokio::task::JoinError {
|
||||
fn status(&self) -> Status {
|
||||
Status::new(Code::Internal, format!("{}", self))
|
||||
Status::new(Code::Internal, format!("{:#}", self))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToStatus for prost_types::TimestampError {
|
||||
fn status(&self) -> Status {
|
||||
Status::new(Code::Internal, format!("{}", self))
|
||||
Status::new(Code::Internal, format!("{:#}", self))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToStatus for std::num::ParseIntError {
|
||||
fn status(&self) -> Status {
|
||||
Status::new(Code::Internal, format!("{}", self))
|
||||
Status::new(Code::Internal, format!("{:#}", self))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user