From 3658290820e4cc97b9f0918d8bcccea12bb9079d Mon Sep 17 00:00:00 2001 From: Dallas <5322142+gitdallas@users.noreply.github.com> Date: Fri, 8 Nov 2024 12:43:37 -0600 Subject: [PATCH] fix(12782): display actual error msg for failed mr creation (#3444) 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, ${