squash! server : use httplib status codes

Revert changes of using httplib's StatusCode in format_error_response.
This commit is contained in:
Daniel Bevenius 2025-02-03 16:48:14 +01:00
parent 802c94524f
commit 5e602e9152

View file

@ -1051,31 +1051,31 @@ static json format_error_response(const std::string & message, const enum error_
switch (type) { switch (type) {
case ERROR_TYPE_INVALID_REQUEST: case ERROR_TYPE_INVALID_REQUEST:
type_str = "invalid_request_error"; type_str = "invalid_request_error";
code = httplib::StatusCode::BadRequest_400; code = 400;
break; break;
case ERROR_TYPE_AUTHENTICATION: case ERROR_TYPE_AUTHENTICATION:
type_str = "authentication_error"; type_str = "authentication_error";
code = httplib::StatusCode::Unauthorized_401; code = 401;
break; break;
case ERROR_TYPE_NOT_FOUND: case ERROR_TYPE_NOT_FOUND:
type_str = "not_found_error"; type_str = "not_found_error";
code = httplib::StatusCode::NotFound_404; code = 404;
break; break;
case ERROR_TYPE_SERVER: case ERROR_TYPE_SERVER:
type_str = "server_error"; type_str = "server_error";
code = httplib::StatusCode::InternalServerError_500; code = 500;
break; break;
case ERROR_TYPE_PERMISSION: case ERROR_TYPE_PERMISSION:
type_str = "permission_error"; type_str = "permission_error";
code = httplib::StatusCode::Forbidden_403; code = 403;
break; break;
case ERROR_TYPE_NOT_SUPPORTED: case ERROR_TYPE_NOT_SUPPORTED:
type_str = "not_supported_error"; type_str = "not_supported_error";
code = httplib::StatusCode::NotImplemented_501; code = 501;
break; break;
case ERROR_TYPE_UNAVAILABLE: case ERROR_TYPE_UNAVAILABLE:
type_str = "unavailable_error"; type_str = "unavailable_error";
code = httplib::StatusCode::ServiceUnavailable_503; code = 503;
break; break;
} }
return json { return json {