All files / sportident/src/utils errors.ts

100% Statements 12/12
100% Branches 7/7
100% Functions 3/3
100% Lines 10/10

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 2238x 14x 1x   13x     38x     44x 44x         38x   38x 3x    
export const getErrorOrThrow = (err: unknown): Error|SiError => {
    if (!(err instanceof Error) && !(err instanceof SiError)) {
        throw new Error('Thrown thing is not an error');
    }
    return err;
};
 
export class SiError {
    // eslint-disable-next-line no-useless-constructor
    constructor(
                public message: string = '',
        public stack = [],
    // eslint-disable-next-line no-empty-function
    ) {}
}
 
export class NotImplementedError extends SiError {}
 
export const notImplemented = (message?: string): never => {
    throw new NotImplementedError(message || 'Not implemented');
};