src/app/core/logging/reported-errors.ts
What Logging.error(message, err) / Logging.warn(message, err) report:
the logged message as the error, with the logged error as its cause.
Named "Error", so that titles read "Error:
Error
No results matching.
Error
constructor(message: string, cause?: unknown)
|
|||||||||
|
Defined in src/app/core/logging/reported-errors.ts:37
|
|||||||||
|
Parameters :
|
export class NamedError extends Error {
/** Context for the report, kept out of the message so that it does not split the issue. */
readonly details?: Record<string, unknown>;
constructor(
name: string,
message: string,
options?: {
cause?: unknown;
details?: Record<string, unknown>;
},
) {
super(
message,
options?.cause === undefined ? undefined : { cause: options.cause },
);
this.name = name;
this.details = options?.details;
}
}
/**
* What `Logging.error(message, err)` / `Logging.warn(message, err)` report:
* the logged message as the error, with the logged error as its `cause`.
*
* Named "Error", so that titles read "Error: <message>"; remote monitoring
* recognizes it by class instead.
*/
export class LoggedError extends Error {
constructor(message: string, cause?: unknown) {
super(message, { cause });
this.name = "Error";
}
}