diff --git a/src/core/server/ui_settings/routes/delete.ts b/src/core/server/ui_settings/routes/delete.ts index 5da69e043a5e1..f8ab4d5d0c2c4 100644 --- a/src/core/server/ui_settings/routes/delete.ts +++ b/src/core/server/ui_settings/routes/delete.ts @@ -34,10 +34,10 @@ export function registerDeleteRoute(router: IRouter) { }); } catch (error) { if (SavedObjectsErrorHelpers.isSavedObjectsClientError(error)) { - return { + return response.customError({ body: error, statusCode: error.output.statusCode, - }; + }); } if (error instanceof CannotOverrideError) {