From 48aebea6cf8b3261c9357b5bce46f4408732612a Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 29 Oct 2025 15:23:53 -0700 Subject: [PATCH] Show error --- server/routers/blueprints/applyYAMLBlueprint.ts | 10 +++++++--- src/components/CreateBlueprintForm.tsx | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/server/routers/blueprints/applyYAMLBlueprint.ts b/server/routers/blueprints/applyYAMLBlueprint.ts index 307f4851..e9895a02 100644 --- a/server/routers/blueprints/applyYAMLBlueprint.ts +++ b/server/routers/blueprints/applyYAMLBlueprint.ts @@ -102,6 +102,7 @@ export async function applyYAMLBlueprint( let blueprint: Blueprint | null = null; + let error: string | null = null; try { blueprint = await applyBlueprint({ orgId, @@ -109,17 +110,20 @@ export async function applyYAMLBlueprint( source: "UI", configData: parsedConfig }); - } catch (error) { + } catch (err) { // We do nothing, the error is thrown for the other APIs & websockets for backwards compatibility // for this API, the error is already saved in the blueprint and we don't need to handle it - logger.error(error); + logger.error(err); + if (err instanceof Error) { + error = err.message; + } } if (!blueprint) { return next( createHttpError( HttpCode.INTERNAL_SERVER_ERROR, - "Failed to save blueprint in the database" + error ? error : "An unknown error occurred while applying the blueprint" ) ); } diff --git a/src/components/CreateBlueprintForm.tsx b/src/components/CreateBlueprintForm.tsx index 2af31650..e0f592a1 100644 --- a/src/components/CreateBlueprintForm.tsx +++ b/src/components/CreateBlueprintForm.tsx @@ -87,11 +87,13 @@ export default function CreateBlueprintForm({ if (!isValid) return; - const payload = form.getValues(); const res = await api .put< AxiosResponse - >(`/org/${orgId}/blueprint/`, payload) + >(`/org/${orgId}/blueprint/`, { + name: form.getValues("name"), + blueprint: form.getValues("contents") + }) .catch((e) => { toast({ variant: "destructive",