ValidationError was not correctly handled
This commit is contained in:
parent
4c693e6524
commit
e86ecbac63
|
@ -69,13 +69,15 @@ async fn generate(
|
||||||
) -> poem::Result<Json<serde_json::Value>> {
|
) -> poem::Result<Json<serde_json::Value>> {
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
|
|
||||||
let (input_length, validated_request) = validation
|
let (input_length, validated_request) = match validation
|
||||||
.validate(GenerateRequest {
|
.validate(GenerateRequest {
|
||||||
inputs: req.inputs.clone(),
|
inputs: req.inputs.clone(),
|
||||||
parameters: req.parameters.clone(),
|
parameters: req.parameters.clone(),
|
||||||
})
|
})
|
||||||
.await
|
.await {
|
||||||
.unwrap();
|
Ok(result) => result,
|
||||||
|
Err(_) => return Err(poem::Error::from_status(StatusCode::INTERNAL_SERVER_ERROR))
|
||||||
|
};
|
||||||
|
|
||||||
let output = infer.infer(input_length, validated_request).await;
|
let output = infer.infer(input_length, validated_request).await;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue