fix(router): Fix HTTP status codes
This commit is contained in:
parent
6c781025ae
commit
91f5f86280
|
@ -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(),
|
||||
}),
|
||||
|
|
Loading…
Reference in New Issue