All files / src/classes CoreError.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25                                        9x 9x      
import type { ILogChannel } from '../lib';
 
/**
 * Represents an error that occurs within the core system.
 *
 * This class extends the native {@link Error} object and automatically logs
 * the provided error message through the supplied logging channel.
 *
 * @class
 * @extends Error
 *
 * @param {string} errorMessage - The description of the error.
 * @param {ILogChannel} logger - The logging channel used to record the error.
 *
 * @example
 * // This example demonstrates how the CoreError class logs the error,
 * // but it is omitted per the instructions.
 */
export default class CoreError extends Error {
  constructor(errorMessage: string, logger: ILogChannel) {
    super(errorMessage);
    logger.error('G-ERR:', errorMessage);
  }
}