diff --git a/backend/src/routes/api/modelRegistries/index.ts b/backend/src/routes/api/modelRegistries/index.ts index 1e2bccc961..e4897a9fa6 100644 --- a/backend/src/routes/api/modelRegistries/index.ts +++ b/backend/src/routes/api/modelRegistries/index.ts @@ -1,6 +1,7 @@ import { FastifyReply, FastifyRequest } from 'fastify'; import { secureAdminRoute } from '../../../utils/route-security'; import { KubeFastifyInstance, ModelRegistryKind, RecursivePartial } from '../../../types'; +import createError from 'http-errors'; import { createModelRegistryAndSecret, deleteModelRegistryAndSecret, @@ -61,7 +62,9 @@ export default async (fastify: KubeFastifyInstance): Promise => { modelRegistryNamespace, databasePassword, !!dryRun, - ); + ).catch((e) => { + throw createError(e.statusCode, e?.body?.message); + }); } catch (e) { fastify.log.error( `ModelRegistry ${modelRegistry.metadata.name} could not be created, ${