All files / src/libs/Modals/CustomModal/interfaces Exceptions.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 3/3
100% Lines 9/9

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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46          1x           4x 4x             1x           1x 1x               1x             3x 3x      
import { ICustomModal } from './ICustomModal';
 
/**
 * General error class for {@link ICustomModal}
 */
export class CustomModalError extends Error {
    /**
     * Creates a new instance of {@link CustomModalError}
     * @param message **The error message**
     */
    constructor(message: string) {
        super(message);
        this.name = 'CustomModalError';
    }
}
/**
 * Error class for missing callbacks in {@link ICustomModal}.
 * @see {@link ICustomModal.setOnOpen}
 */
export class MissingCallbackError extends CustomModalError {
    /**
     * Creates a new instance of {@link MissingCallbackError}
     * @param callbackName **The name of the missing callback**
     */
    constructor(callbackName: string) {
        super(`The ${callbackName} callback must be set.`);
        this.name = 'MissingCallbackError';
    }
}
 
/**
 * Error class for errors in the callback functions in {@link ICustomModal}.
 * @see {@link ICustomModal}
 */
export class CallbackError extends CustomModalError {
    /**
     * Creates a new instance of {@link CallbackError}
     * @param callbackName **The name of the callback**
     * @param error **The error that occurred**
     */
    constructor(callbackName: string, error: Error) {
        super(`Error in ${callbackName} callback: ${error.message}`);
        this.name = 'CallbackError';
    }
}
 
Zur TypeDoc-Dokumentation