mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-08 05:56:38 +00:00
Show error
This commit is contained in:
@@ -102,6 +102,7 @@ export async function applyYAMLBlueprint(
|
|||||||
|
|
||||||
let blueprint: Blueprint | null = null;
|
let blueprint: Blueprint | null = null;
|
||||||
|
|
||||||
|
let error: string | null = null;
|
||||||
try {
|
try {
|
||||||
blueprint = await applyBlueprint({
|
blueprint = await applyBlueprint({
|
||||||
orgId,
|
orgId,
|
||||||
@@ -109,17 +110,20 @@ export async function applyYAMLBlueprint(
|
|||||||
source: "UI",
|
source: "UI",
|
||||||
configData: parsedConfig
|
configData: parsedConfig
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (err) {
|
||||||
// We do nothing, the error is thrown for the other APIs & websockets for backwards compatibility
|
// 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
|
// 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) {
|
if (!blueprint) {
|
||||||
return next(
|
return next(
|
||||||
createHttpError(
|
createHttpError(
|
||||||
HttpCode.INTERNAL_SERVER_ERROR,
|
HttpCode.INTERNAL_SERVER_ERROR,
|
||||||
"Failed to save blueprint in the database"
|
error ? error : "An unknown error occurred while applying the blueprint"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,11 +87,13 @@ export default function CreateBlueprintForm({
|
|||||||
|
|
||||||
if (!isValid) return;
|
if (!isValid) return;
|
||||||
|
|
||||||
const payload = form.getValues();
|
|
||||||
const res = await api
|
const res = await api
|
||||||
.put<
|
.put<
|
||||||
AxiosResponse<CreateBlueprintResponse>
|
AxiosResponse<CreateBlueprintResponse>
|
||||||
>(`/org/${orgId}/blueprint/`, payload)
|
>(`/org/${orgId}/blueprint/`, {
|
||||||
|
name: form.getValues("name"),
|
||||||
|
blueprint: form.getValues("contents")
|
||||||
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
toast({
|
toast({
|
||||||
variant: "destructive",
|
variant: "destructive",
|
||||||
|
|||||||
Reference in New Issue
Block a user