mail und logging
This commit is contained in:
25
apps/api/src/mail/mail-errors.ts
Normal file
25
apps/api/src/mail/mail-errors.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
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';
|
||||
}
|
||||
Reference in New Issue
Block a user