server: return HTTP 400 for invalid embedding requests (#29060)

This commit is contained in:
Sam Malayek
2026-10-01 16:52:43 +02:00
committed by GitHub
parent 2b36825cbc
commit d775ebf363
3 changed files with 24 additions and 2 deletions
+4
View File
@@ -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;