/*
Create a custom Error class
761600
function error(name, code) {

  return function (_Error) {
    _inherits(MJMLError, _Error);

    function MJMLError(message) {
      _classCallCheck(this, MJMLError);

      var _this = _possibleConstructorReturn(this, (MJMLError.__proto__ || Object.getPrototypeOf(MJMLError)).call(this, '[MJMLError] ' + name + ': ' + message));

      _this.status = code;
      return _this;
    }

    return MJMLError;
  }(Error);
}
232575
function VError(options)
{
	var args, causedBy, ctor, tailmsg;

	if (options instanceof Error || typeof (options) === 'object') {
		args = Array.prototype.slice.call(arguments, 1);
	} else {
		args = Array.prototype.slice.call(arguments, 0);
		options = undefined;
	}

	tailmsg = args.length > 0 ?
	    mod_extsprintf.sprintf.apply(null, args) : '';
	this.jse_shortmsg = tailmsg;
	this.jse_summary = tailmsg;

	if (options) {
		causedBy = options.cause;

		if (!causedBy || !(options.cause instanceof Error))
			causedBy = options;

		if (causedBy && (causedBy instanceof Error)) {
			this.jse_cause = causedBy;
			this.jse_summary += ': ' + causedBy.message;
		}
	}

	this.message = this.jse_summary;
	Error.call(this, this.jse_summary);

	if (Error.captureStackTrace) {
		ctor = options ? options.constructorOpt : undefined;
		ctor = ctor || arguments.callee;
		Error.captureStackTrace(this, ctor);
	}
}
737833
function makeHttpErrorClass(code, description) {
  /*****************************************************************************
   * @method C
   * @description C description
   * @param {string} message -- xxx
   * @param {xxx} response -- xxx
   * @returns {xxx} -- xxx
   */
  var C = function(message, response) {
    HttpError.call(this, message, code, description, response, false)
    Error.captureStackTrace(this, arguments.callee)
  }
  util.inherits(C, HttpError)
  C.code = code // Tag class with code as well for convenience

  return C
}
1311571
function _displayCreationError(e, errorInfo) {
        window.setTimeout(function () {
            var error = errorInfo.type,
                isFolder = errorInfo.isFolder,
                name = errorInfo.name;

            if (error === FileSystemError.ALREADY_EXISTS) {
                _showErrorDialog(ERR_TYPE_CREATE_EXISTS, isFolder, null, name);
            } else if (error === ProjectModel.ERROR_INVALID_FILENAME) {
                _showErrorDialog(ERR_TYPE_INVALID_FILENAME, isFolder, ProjectModel._invalidChars);
            } else {
                var errString = error === FileSystemError.NOT_WRITABLE ?
                        Strings.NO_MODIFICATION_ALLOWED_ERR :
                        StringUtils.format(Strings.GENERIC_ERROR, error);

                _showErrorDialog(ERR_TYPE_CREATE, isFolder, errString, name).getPromise();
            }
        }, 10);
    }
912908
function WError(options)
{
	Error.call(this);

	var args, cause, ctor;
	if (typeof (options) === 'object') {
		args = Array.prototype.slice.call(arguments, 1);
	} else {
		args = Array.prototype.slice.call(arguments, 0);
		options = undefined;
	}

	if (args.length > 0) {
		this.message = mod_extsprintf.sprintf.apply(null, args);
	} else {
		this.message = '';
	}

	if (options) {
		if (options instanceof Error) {
			cause = options;
		} else {
			cause = options.cause;
			ctor = options.constructorOpt;
		}
	}

	Error.captureStackTrace(this, ctor || this.constructor);
	if (cause)
		this.cause(cause);

}
569699
function (isGlobal, server, err, msg, session, resp, opts, cb) {
  let handler;
  if (isGlobal) {
    handler = server.app.get(Constants.RESERVED.GLOBAL_ERROR_HANDLER);
  } else {
    handler = server.app.get(Constants.RESERVED.ERROR_HANDLER);
  }
  if (!handler) {
    logger.debug('no default error handler to resolve unknown exception. ' + err.stack);
    utils.invokeCallback(cb, err, resp, opts);
  } else {
    if (handler.length === 5) {
      handler(err, msg, resp, session, cb);
    } else {
      handler(err, msg, resp, session, opts, cb);
    }
  }
}
18904
function createCompilerError(
  message: string,
  locations?: ?$ReadOnlyArray<Location>,
  nodes?: ?$ReadOnlyArray<ASTNode>,
): CompilerError {
  let messageWithLocations = message;
  if (locations != null) {
    const printedLocations = printLocations(locations);
    messageWithLocations =
      printedLocations.length === 0
        ? message
        : [message, ...printedLocations].join('\n\n') + '\n';
  }
  const error = new GraphQLError(
    `Internal Error: ${messageWithLocations}`,
    nodes ?? [],
  );
  return new Error(error.message);
}
32061
function (error) {
        if (!this.started) {
            return;
        }

        var errorHandlers = this.errorHandlers,
            length = errorHandlers.length,
            errorHandler,
            errorHandled = false,
            errorString,
            i;

        //Exit handling
        if (error instanceof SystemExit) {
            this._exit(error.code);
            return;
        }

        try {
            for (i = 0; i < length; i += 1) {
                errorHandler = errorHandlers[i];
                errorHandled = !!errorHandler(error);

                if (errorHandled) {
                    return;
                }
            }
        } catch (e) {
            this._printError(e);
            this._exit(1);
        }

        //Default error handling
        errorString = '' + (error.stack || error);
        this._printError(errorString);
        this._exit(1);
    }
682515
function createError(name, message) {
        var e = new Error(message);
        e.name = name || 'DOMException';
        e.message = message;
        return e;
    }
796165
function Extendable(errorClass) {

  /**
   * @constructor
   */
  function ExtendableClass() {
    errorClass.apply(this, arguments);
  }

  ExtendableClass.prototype = Object.create(errorClass.prototype);
  Object.setPrototypeOf ? Object.setPrototypeOf(ExtendableClass, errorClass) : ExtendableClass.__proto__ = errorClass;

  return ExtendableClass;
}
135492
function multipleErrors(errors) {
  var messages = errors.map(function(e) { return e.message; });
  return createError(
      ['Errors:'].concat(messages).join('\n- '),
      errors[0].interval);
}
725979
function (errors) {
    if (typeof errors === 'string' || errors instanceof Error) {
      errors = {'*': '' + errors};
    }
    else if (errors == null) {
      errors = {'*': 'Unknown error'};
    }
    return new DS.InvalidError(errors);
  }
694720
function createError(name, options)
{
  // TODO: validate that name is a string and options is an object

  // TODO: this code is a bit of a mess and needs to be cleaned up

  // create a new error
  var error = new Error();

  // set its name
  error.name = name;

  // set the error code
  var code;
  error.code = code = options.code;

  // if no error message was specified in the options
  var message = options.message;
  if (!message)
  {
    // use the error code to get the error message template
    var messageTemplate = errorMessages[code];

    // if some error message arguments were specified, substitute them into the
    // error message template to get the full error message, otherwise just use
    // the error message template as the error message
    var messageArgs = options.messageArgs;
    if (messageArgs)
    {
      messageArgs = messageArgs.slice();
      messageArgs.unshift(messageTemplate);
      message = Util.format.apply(Util, messageArgs);
    }
    else
    {
      message = messageTemplate;
    }
  }
  error.message = message;

  // if no sql state was specified in the options, use the error code to try to
  // get the appropriate sql state
  var sqlState = options.sqlState;
  if (!sqlState)
  {
    sqlState = errCodeToSqlState[code];
  }
  error.sqlState = sqlState;

  // set the error data
  error.data = options.data;

  // set the error response and response body
  error.response     = options.response;
  error.responseBody = options.responseBody;

  // set the error cause
  error.cause = options.cause;

  // set the error's fatal flag
  error.isFatal = options.isFatal;

  // if the error is not synchronous, add an externalize() method
  if (!options.synchronous)
  {
    error.externalize = function(errorCode, errorMessageArgs, sqlState)
    {
      var propNames =
      [
        'name',
        'code',
        'message',
        'sqlState',
        'data',
        'response',
        'responseBody',
        'cause',
        'isFatal',
        'stack'
      ];

      var externalizedError = new Error();

      var propName, propValue;
      for (var index = 0, length = propNames.length; index < length; index++)
      {
        propName = propNames[index];
        propValue = this[propName];
        if (Util.exists(propValue))
        {
          externalizedError[propName] = propValue;
        }
      }

      return externalizedError;
    };
  }

  return error;
}
982477
function createErrorMessage(errorcode) {
	if (errorcode in ERRORS) {
		var args = Array.prototype.slice.call(arguments,1);
		var entry = ERRORS[errorcode];
		if (entry.argcount && entry.argcount!==args.length) {
			// this should only ever get called if we have a bug in this library
			throw new Error("Internal failure. Unexpected usage of internal command. Please report error code: "+errorcode+"(invalid args) to the developer with the following stack trace:"+new Error().stack);
		}
		return new RequestSSLError((args.length ? util.format.apply(util.format,[entry.message].concat(args)) : entry.message), errorcode);
	}
	else {
		// this should only ever get called if we have a bug in this library
		throw new Error("Internal failure. Unexpected usage of internal command. Please report error code: "+errorcode+"(invalid error code) to the developer with the following stack trace:"+new Error().stack);
	}
}
416178
function errorToExceptionCallback(cb) {
    var browser = this;

    return function errorWrapped(err) {
        if (err) throw err;
        if (cb) {
            cb.apply(browser, _.tail(arguments));
        }
    };
}
1172958
function formatError(e) {
  if (!e.error) {
    return e.message;
  }

  // Don't show stacktrace on informational errors
  if (e.error instanceof Information) {
    return e.error.message;
  }

  // PluginError
  if (typeof e.error.showStack === "boolean") {
    return e.error.toString();
  }
  // Normal error
  if (e.error.stack) {
    return e.error.stack;
  }
  // Unknown (string, number, etc.)
  return new Error(String(e.error)).stack;
}
339252
function recreateError(err) {
	const Class = module.exports[err.name];
	if (Class) {
		switch(err.name) {
			case "MoleculerError": return new Class(err.message, err.code, err.type, err.data);
			case "MoleculerRetryableError": return new Class(err.message, err.code, err.type, err.data);
			case "MoleculerServerError": return new Class(err.message, err.code, err.type, err.data);
			case "MoleculerClientError": return new Class(err.message, err.code, err.type, err.data);

			case "ValidationError": return new Class(err.message, err.type, err.data);

			case "ServiceNotFoundError": return new Class(err.data);
			case "ServiceNotAvailableError": return new Class(err.data);
			case "RequestTimeoutError": return new Class(err.data);
			case "RequestSkippedError": return new Class(err.data);
			case "RequestRejectedError": return new Class(err.data);
			case "QueueIsFullError": return new Class(err.data);
			case "MaxCallLevelError": return new Class(err.data);
			case "GracefulStopTimeoutError": return new Class(err.data);
			case "ProtocolVersionMismatchError": return new Class(err.data);
			case "InvalidPacketDataError": return new Class(err.data);

			case "ServiceSchemaError":
			case "BrokerOptionsError": return new Class(err.message, err.data);
		}
	}
}