fix(router): Fix HTTP status codes

This commit is contained in:
OlivierDehaene 2022-11-14 14:34:15 +01:00
parent 6c781025ae
commit 91f5f86280
2 changed files with 3 additions and 3 deletions

View File

@ -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(),
}),

View File

@ -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(),
}),