Improved error handling
parent
391f060744
commit
50bd9b854a
|
@ -14,7 +14,7 @@ use iron::prelude::*;
|
||||||
use iron::headers::{ Authorization, Bearer };
|
use iron::headers::{ Authorization, Bearer };
|
||||||
use iron::status::Status;
|
use iron::status::Status;
|
||||||
use router::Router;
|
use router::Router;
|
||||||
use urlencoded::UrlEncodedQuery;
|
use urlencoded::{ UrlDecodingError, UrlEncodedQuery };
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
@ -44,7 +44,8 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(_) => return Ok(Response::with((Status::BadRequest, "400 Bad Request"))),
|
Err(UrlDecodingError::BodyError(_)) => return Ok(Response::with((Status::BadRequest, "400 Bad Request"))),
|
||||||
|
Err(UrlDecodingError::EmptyQuery) => (),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check token from Authorization header
|
// Check token from Authorization header
|
||||||
|
|
Loading…
Reference in New Issue