/**
 * A base class for custom errors.
 */ export abstract class ErrorBase implements Error { /**
     * The name of the error.
     */ name = "Error" ; /**
     * A human readable message explaining the reason for the error.
     */ message : string ; /**
     * The stack trace.
     */ stack : string ; /**
     * The cause of this error.
     */ private _cause : Error ; constructor ( message , cause ? ) { Error . call ( this , message ) ; if ( cause ) { this . _cause = cause ; } this . message = message ; if ( ( < any > Error ) . captureStackTrace ) { ( < any > Error ) . captureStackTrace ( this , this . constructor ) ; } else { this . stack = ( < any > new Error ( message ) ) . stack ; } } } ErrorBase . prototype = < any > Object . create ( Error . prototype ) ; ErrorBase . prototype . constructor = ErrorBase ; ( < any > ErrorBase . prototype ) . cause = function ( ) { return this . _cause ; } ;