function PersistentError(message, cause) {
  message = (message ? message : 'An unexpected persistent error occured.');

  if (Error.hasOwnProperty('captureStackTrace')) {
    Error.captureStackTrace(this, this.constructor);
  } else {
    this.stack = (new Error()).stack;
  }

  this.message = message;
  this.name = this.constructor.name;

  if (cause) {
    this.cause = cause;
    if (cause.stack) {
      this.stack += '\nCaused By: ' + cause.stack;
    }
  }
}
//do not use class here, since we can't change the class prototype
do not use class here, since we can't change the class prototype
do not use class here since we can ' t change the class prototype
function PersistentError(message, cause) {
  message = (message ? message : 'An unexpected persistent error occured.');
  if (Error.hasOwnProperty('captureStackTrace')) {
    Error.captureStackTrace(this, this.constructor);
  } else {
    this.stack = (new Error()).stack;
  }
  this.message = message;
  this.name = this.constructor.name;
  if (cause) {
    this.cause = cause;
    if (cause.stack) {
      this.stack += '\nCaused By: ' + cause.stack;
    }
  }
}
function PersistentError ( message , cause ) { message = ( message ? message : 'An unexpected persistent error occured.' ) ; if ( Error . hasOwnProperty ( 'captureStackTrace' ) ) { Error . captureStackTrace ( this , this . constructor ) ; } else { this . stack = ( new Error ( ) ) . stack ; } this . message = message ; this . name = this . constructor . name ; if ( cause ) { this . cause = cause ; if ( cause . stack ) { this . stack += '\nCaused By: ' + cause . stack ; } } }
do not use class here, since we can't change the class prototype
do not use class here since we can ' t change the class prototype