function createError(
    filename, line, message, stack = undefined, cause = undefined) {
  const error = {
    message: message,
    fileName: filename,
    lineNumber: line,
    toString: function() {
      return 'Error: ' + message;
    }
  };
  if (stack) {
    error['stack'] = stack;
  }
  if (cause) {
    error['cause'] = cause;
  }

  return error;
}
@param {*} filename
@param {*} line
@param {*} message
@param {*=} stack
@param {*=} cause
@return {*}