aboutsummaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/error.rs b/src/error.rs
index 2d70592..b8a078b 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -46,11 +46,13 @@ pub enum Error {
46 #[from] 46 #[from]
47 source: io::Error, 47 source: io::Error,
48 }, 48 },
49
50 #[error("No ip set for device but ping requested")]
51 NoIpOnPing,
49} 52}
50 53
51impl IntoResponse for Error { 54impl IntoResponse for Error {
52 fn into_response(self) -> Response { 55 fn into_response(self) -> Response {
53 // error!("{}", self.to_string());
54 let (status, error_message) = match self { 56 let (status, error_message) = match self {
55 Self::Json { source } => { 57 Self::Json { source } => {
56 error!("{source}"); 58 error!("{source}");
@@ -80,6 +82,10 @@ impl IntoResponse for Error {
80 Self::IpParse { source } => { 82 Self::IpParse { source } => {
81 error!("{source}"); 83 error!("{source}");
82 (StatusCode::INTERNAL_SERVER_ERROR, "Server Error") 84 (StatusCode::INTERNAL_SERVER_ERROR, "Server Error")
85 },
86 Self::NoIpOnPing => {
87 error!("Ping requested but no ip given");
88 (StatusCode::BAD_REQUEST, "No Ip saved for requested device, but device started")
83 } 89 }
84 }; 90 };
85 let body = Json(json!({ 91 let body = Json(json!({