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

Function err_to_result_code

chirpstack/src/api/backend/mod.rs:191–208  ·  view source on GitHub ↗
(e: anyhow::Error)

Source from the content-addressed store, hash-verified

189}
190
191fn err_to_result_code(e: anyhow::Error) -> backend::ResultCode {
192 if let Some(e) = e.downcast_ref::<StorageError>() {
193 return match e {
194 StorageError::NotFound(_) => backend::ResultCode::UnknownDevAddr,
195 StorageError::InvalidMIC | StorageError::InvalidDevNonce => {
196 backend::ResultCode::MICFailed
197 }
198 _ => backend::ResultCode::Other,
199 };
200 }
201 if let Some(e) = e.downcast_ref::<UplinkError>() {
202 return match e {
203 UplinkError::RoamingIsNotAllowed => backend::ResultCode::DevRoamingDisallowed,
204 _ => backend::ResultCode::Other,
205 };
206 }
207 backend::ResultCode::Other
208}
209
210async fn handle_pr_start_req(
211 sender_client: Arc<backend::Client>,

Callers 5

err_to_responseFunction · 0.85
handle_pr_start_reqFunction · 0.85
handle_pr_stop_reqFunction · 0.85
handle_xmit_data_reqFunction · 0.85
handle_home_ns_reqFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected