All files error.ts

100% Statements 18/18
100% Branches 6/6
100% Functions 3/3
100% Lines 18/18

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 211x   1x 74x 74x 74x 74x 74x 74x 3x 3x 74x   74x 5x 4x 4x 5x 5x 74x  
import { skipDevMessages } from './dev';
 
export class FlowfulError extends Error {
  cause?: unknown;
  constructor(message: string, cause?: any) {
    super(message);
    this.name = 'FlowfulError';
    this.cause = cause;
    if (this.cause && !skipDevMessages()) {
      this.logCause();
    }
  }
 
  logCause() {
    if (this.cause) {
      console.error(`${this.message} Caused by:`, this.cause);
    }
    return this;
  }
}