"git@developer.sourcefind.cn:OpenDAS/fairscale.git" did not exist on "9f347f373e32ee5cad11a40b70b8e28a74b5e2d4"
Commit 91f5f862 authored by OlivierDehaene's avatar OlivierDehaene
Browse files

fix(router): Fix HTTP status codes

parent 6c781025
......@@ -220,7 +220,7 @@ impl From<InferError> for (StatusCode, Json<ErrorResponse>) {
fn from(err: InferError) -> Self {
match err {
InferError::GenerationError(_) => (
StatusCode::INTERNAL_SERVER_ERROR,
StatusCode::FAILED_DEPENDENCY,
Json(ErrorResponse {
error: err.to_string(),
}),
......
......@@ -101,7 +101,7 @@ fn validation_worker(
) {
// Loop over requests
while let Some((request, response_tx)) = receiver.blocking_recv() {
if request.parameters.temperature < 0.0 {
if request.parameters.temperature <= 0.0 {
response_tx
.send(Err(ValidationError::Temperature))
.unwrap_or(());
......@@ -162,7 +162,7 @@ pub enum ValidationError {
impl From<ValidationError> for (StatusCode, Json<ErrorResponse>) {
fn from(err: ValidationError) -> Self {
(
StatusCode::BAD_REQUEST,
StatusCode::UNPROCESSABLE_ENTITY,
Json(ErrorResponse {
error: err.to_string(),
}),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment