/ .setup / error-with-remedy.mjs
error-with-remedy.mjs
 1  export class ErrorWithRemedy extends Error {
 2    constructor(errorMessage, remedyMessage) {
 3      super(errorMessage);
 4      this.name = this.constructor.name;
 5      this.remedy = remedyMessage;
 6  
 7      // Maintaining proper stack trace for where our error was thrown (only available on V8)
 8      if (Error.captureStackTrace) {
 9        Error.captureStackTrace(this, this.constructor);
10      }
11    }
12  }