error.js 1.2 KB

123
  1. !function(require, directRequire){
  2. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.makeSummerError=exports.SummerErrors=exports.SummerError=void 0;const config_1=require("../config");class SummerError extends Error{constructor(r){super(r.message),this.stack=r.stack,r.code&&(this.code=r.code),r.path&&(this.path=r.path),r.plugin&&(this.plugin=r.plugin),r.hook&&(this.hook=r.hook)}toString(){return`${super.toString()}${this.path?"\nFile: "+this.path:""}`}toJSON(){return{type:"SummerError",message:this.message,stack:this.stack,code:this.code,path:this.path,plugin:this.plugin,hook:this.hook}}}function makeSummerError(r,e,o){if(r instanceof SummerError)return e&&!r.code&&(r.code=e),o&&!r.path&&(r.path=o),r;return new SummerError({code:e||exports.SummerErrors.SUMMER_PLUGIN_ERR,message:r instanceof Error?r.toString():"string"==typeof r?r:"Unknown Error Message "+r,path:o,stack:r instanceof Error?null==r?void 0:r.stack:void 0})}exports.SummerError=SummerError,exports.SummerErrors={SUMMER_PLUGIN_ERR:config_1.SUMMER_PLUGIN_ERR,SUMMER_PLUGIN_CODE_ERR:config_1.SUMMER_PLUGIN_CODE_ERR},exports.makeSummerError=makeSummerError;
  3. }(require("licia/lazyImport")(require), require)