@altostra/core
Version:
Core library for shared types and logic
1 lines • 613 B
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ServiceError=void 0;class ServiceError extends Error{constructor(r,e,t,s){super(r),this.code=e,this.inner=t,this.data=s}getFullErrorMessage(){return`${this.message}${this.getErrorMessageFor(this.inner)}`}getFullStack(){return`${this.stack}${this.getStackFor(this.inner)}`}getStackFor(r){return r instanceof ServiceError?`\n${r.stack}${this.getStackFor(r.inner)}`:r?"\n"+r.stack:""}getErrorMessageFor(r){return r instanceof ServiceError?"; "+r.getFullErrorMessage():r instanceof Error?"; "+r.message:""}}exports.ServiceError=ServiceError;