Files
ldap-identidy/apps/api/src/mail/mail-errors.ts
Bastian Wagner edd88acd98 mail und logging
2026-07-17 11:50:12 +02:00

26 lines
695 B
TypeScript

export class PortalMailTemplateError extends Error {
constructor(
readonly templateName: string,
cause: unknown,
) {
super(`Mail template rendering failed for "${templateName}": ${errorMessage(cause)}`);
this.name = 'PortalMailTemplateError';
this.cause = cause;
}
}
export class PortalMailDeliveryError extends Error {
constructor(
readonly templateName: string,
cause: unknown,
) {
super(`Mail delivery failed for "${templateName}": ${errorMessage(cause)}`);
this.name = 'PortalMailDeliveryError';
this.cause = cause;
}
}
function errorMessage(error: unknown): string {
return error instanceof Error ? error.message : 'unknown error';
}