MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / status

Method status

chirpstack/src/api/error.rs:10–71  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

8
9impl ToStatus for storage::error::Error {
10 fn status(&self) -> Status {
11 match self {
12 storage::error::Error::NotFound(_) => Status::new(Code::NotFound, format!("{}", self)),
13 storage::error::Error::AlreadyExists(_) => {
14 Status::new(Code::AlreadyExists, format!("{:#}", self))
15 }
16 storage::error::Error::InvalidEmail => {
17 Status::new(Code::InvalidArgument, format!("{:#}", self))
18 }
19 storage::error::Error::PasswordTooShort => {
20 Status::new(Code::InvalidArgument, format!("{:#}", self))
21 }
22 storage::error::Error::PasswordTooLong => {
23 Status::new(Code::InvalidArgument, format!("{:#}", self))
24 }
25 storage::error::Error::HashPassword(_) => {
26 Status::new(Code::InvalidArgument, format!("{:#}", self))
27 }
28 storage::error::Error::InvalidUsernameOrPassword => {
29 Status::new(Code::Unauthenticated, format!("{:#}", self))
30 }
31 storage::error::Error::InvalidPayload(_) => {
32 Status::new(Code::Internal, format!("{:#}", self))
33 }
34 storage::error::Error::InvalidMIC => {
35 Status::new(Code::InvalidArgument, format!("{:#}", self))
36 }
37 storage::error::Error::InvalidDevNonce => {
38 Status::new(Code::InvalidArgument, format!("{:#}", self))
39 }
40 storage::error::Error::Validation(_) => {
41 Status::new(Code::InvalidArgument, format!("{:#}", self))
42 }
43 storage::error::Error::NotAllowed(_) => {
44 Status::new(Code::InvalidArgument, format!("{:#}", self))
45 }
46 storage::error::Error::Diesel(_) => Status::new(Code::Internal, format!("{:#}", self)),
47 storage::error::Error::Anyhow(_) => Status::new(Code::Internal, format!("{:#}", self)),
48 storage::error::Error::Lrwn(_) => Status::new(Code::Internal, format!("{:#}", self)),
49 storage::error::Error::TokioJoin(_) => {
50 Status::new(Code::Internal, format!("{:#}", self))
51 }
52 storage::error::Error::Redis(_) => Status::new(Code::Internal, format!("{:#}", self)),
53 storage::error::Error::ProstDecode(_) => {
54 Status::new(Code::Internal, format!("{:#}", self))
55 }
56 storage::error::Error::ValidatorValidate(_) => {
57 Status::new(Code::InvalidArgument, format!("{:#}", self))
58 }
59 &storage::error::Error::FCntUpAlreadyUpdated(_) => {
60 Status::new(Code::Internal, format!("{:#}", self))
61 }
62 storage::error::Error::Multi(errors) => {
63 let errors = errors
64 .iter()
65 .map(|e| e.to_string())
66 .collect::<Vec<String>>()
67 .join(", ");

Callers 15

test_async_requestFunction · 0.80
test_sync_requestFunction · 0.80
test_log_fn_okFunction · 0.80
test_log_fn_errorFunction · 0.80
test_pilot_thingsFunction · 0.80
test_thingsboardFunction · 0.80
test_mydevicesFunction · 0.80
test_influxdbFunction · 0.80
test_blynkFunction · 0.80
test_httpFunction · 0.80
test_ifttt_no_prefixFunction · 0.80

Calls 2

iterMethod · 0.80
to_stringMethod · 0.80

Tested by 15

test_async_requestFunction · 0.64
test_sync_requestFunction · 0.64
test_log_fn_okFunction · 0.64
test_log_fn_errorFunction · 0.64
test_pilot_thingsFunction · 0.64
test_thingsboardFunction · 0.64
test_mydevicesFunction · 0.64
test_influxdbFunction · 0.64
test_blynkFunction · 0.64
test_httpFunction · 0.64
test_ifttt_no_prefixFunction · 0.64