server: return HTTP 400 for invalid embedding requests (#29060)
This commit is contained in:
1 parent
2b36825cbc
commit
d775ebf363
3 files changed
+24
-2
No files matched your search
@@ -61,6 +61,10 @@ static server_http_context::handler_t ex_wrapper(server_http_context::handler_t
|
||||
// treat invalid_argument as invalid request (400)
|
||||
error = ERROR_TYPE_INVALID_REQUEST;
|
||||
message = e.what();
|
||||
} catch (const common_json_error & e) {
|
||||
// JSON parse and type errors are invalid requests (400)
|
||||
error = ERROR_TYPE_INVALID_REQUEST;
|
||||
message = e.what();
|
||||
} catch (const std::exception & e) {
|
||||
// treat other exceptions as server error (500)
|
||||
error = ERROR_TYPE_SERVER;
|
||||
|
||||
Reference in new issue
Block a user