import { FlowExecCtx } from "@/core/flow.execution.context"; import { getError } from "@pkg/logger"; import { ERROR_CODES, type Err } from "@pkg/result"; export const authErrors = { passwordRotationFailed: (fctx: FlowExecCtx, detail: string): Err => getError({ flowId: fctx.flowId, code: ERROR_CODES.INTERNAL_SERVER_ERROR, message: "Failed to begin 2FA setup", description: "An error occurred while rotating the password for 2FA", detail, }), 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, }), accountNotFound: (fctx: FlowExecCtx): Err => getError({ flowId: fctx.flowId, code: ERROR_CODES.NOT_FOUND, message: "Account not found", description: "Please try again later", detail: "Account not found for user", }), };