From 91c1e52e0287df7041e3de2bc85ec949cad3a481 Mon Sep 17 00:00:00 2001 From: gitdallas <5322142+gitdallas@users.noreply.github.com> Date: Wed, 6 Nov 2024 13:13:10 -0600 Subject: [PATCH] fix(12782): display actual error msg for failed mr creation Signed-off-by: gitdallas <5322142+gitdallas@users.noreply.github.com> --- backend/src/routes/api/modelRegistries/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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, ${