60 lines
2.0 KiB
TypeScript
60 lines
2.0 KiB
TypeScript
import { FlowExecCtx } from "@/core/flow.execution.context";
|
|
import { ERROR_CODES, type Err } from "@pkg/result";
|
|
import { getError } from "@pkg/logger";
|
|
|
|
export const supportedAppErrors = {
|
|
dbError: (fctx: FlowExecCtx, detail: string): Err =>
|
|
getError({
|
|
flowId: fctx.flowId,
|
|
code: ERROR_CODES.DATABASE_ERROR,
|
|
message: "Database operation failed",
|
|
description: "Please try again later",
|
|
detail,
|
|
}),
|
|
|
|
supportedAppNotFound: (fctx: FlowExecCtx, id: number): Err =>
|
|
getError({
|
|
flowId: fctx.flowId,
|
|
code: ERROR_CODES.NOT_FOUND,
|
|
message: "Supported app not found",
|
|
description: "The requested supported app does not exist",
|
|
detail: `No supported app found with ID: ${id}`,
|
|
}),
|
|
|
|
listFailed: (fctx: FlowExecCtx, detail: string): Err =>
|
|
getError({
|
|
flowId: fctx.flowId,
|
|
code: ERROR_CODES.DATABASE_ERROR,
|
|
message: "Failed to list supported apps",
|
|
description: "Try again later",
|
|
detail,
|
|
}),
|
|
|
|
createFailed: (fctx: FlowExecCtx, detail: string): Err =>
|
|
getError({
|
|
flowId: fctx.flowId,
|
|
code: ERROR_CODES.DATABASE_ERROR,
|
|
message: "Failed to create supported app",
|
|
description: "Try again later",
|
|
detail,
|
|
}),
|
|
|
|
updateFailed: (fctx: FlowExecCtx, detail: string): Err =>
|
|
getError({
|
|
flowId: fctx.flowId,
|
|
code: ERROR_CODES.DATABASE_ERROR,
|
|
message: "Failed to update supported app",
|
|
description: "Try again later",
|
|
detail,
|
|
}),
|
|
|
|
deleteFailed: (fctx: FlowExecCtx, detail: string): Err =>
|
|
getError({
|
|
flowId: fctx.flowId,
|
|
code: ERROR_CODES.DATABASE_ERROR,
|
|
message: "Failed to delete supported app",
|
|
description: "Try again later",
|
|
detail,
|
|
}),
|
|
};
|