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>) { ...@@ -220,7 +220,7 @@ impl From<InferError> for (StatusCode, Json<ErrorResponse>) {
fn from(err: InferError) -> Self { fn from(err: InferError) -> Self {
match err { match err {
InferError::GenerationError(_) => ( InferError::GenerationError(_) => (
StatusCode::INTERNAL_SERVER_ERROR, StatusCode::FAILED_DEPENDENCY,
Json(ErrorResponse { Json(ErrorResponse {
error: err.to_string(), error: err.to_string(),
}), }),
......
...@@ -101,7 +101,7 @@ fn validation_worker( ...@@ -101,7 +101,7 @@ fn validation_worker(
) { ) {
// Loop over requests // Loop over requests
while let Some((request, response_tx)) = receiver.blocking_recv() { while let Some((request, response_tx)) = receiver.blocking_recv() {
if request.parameters.temperature < 0.0 { if request.parameters.temperature <= 0.0 {
response_tx response_tx
.send(Err(ValidationError::Temperature)) .send(Err(ValidationError::Temperature))
.unwrap_or(()); .unwrap_or(());
...@@ -162,7 +162,7 @@ pub enum ValidationError { ...@@ -162,7 +162,7 @@ pub enum ValidationError {
impl From<ValidationError> for (StatusCode, Json<ErrorResponse>) { impl From<ValidationError> for (StatusCode, Json<ErrorResponse>) {
fn from(err: ValidationError) -> Self { fn from(err: ValidationError) -> Self {
( (
StatusCode::BAD_REQUEST, StatusCode::UNPROCESSABLE_ENTITY,
Json(ErrorResponse { Json(ErrorResponse {
error: err.to_string(), 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