Recreate an error from a transferred payload `err`

@param {Error} err
@returns {MoleculerError}
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);
		}
	}
}
705740
function(err) {
		/**
		 * If err is an Error object, break the chain and call catch
		 */
		if (err && (err.constructor.name === "Error" || err.constructor.name === "TypeError") && this.onCatch) {
			this.onCatch(err);
			return;
		}

		var nextFn = this.fnStack.shift();
		if (nextFn) {
			/**
			 * Ensure arguments are passed as an Array
			 */
			var args = Array.prototype.slice.call(arguments);
			return this.execute(nextFn.fn, args);
		}
	}
826869
function newError(errorCode, errorMessage) {
		
		var errObj;
		
		if (_.isObject(errorCode)) {
			errObj = errorCode;
		}
		else if (typeof(errorCode) === 'number') {
			errObj = {
				errorCode: errorCode,
			};
			
			if (errorMessage) {
				errObj.message = errorMessage;
			}
		}
		else {
			errObj = {errorCode: 500};
		}
		
		return new Promise(function(resolve, reject) {
			reject(errObj);
		});
	}
1301255
function errorHandler (err) {
  let errorMessage = process.env.DEBUG ? err.stack : err.message;
  console.error(chalk.red(errorMessage));
  process.exit(1);
}
108534
function( err ){
                if( err && ! err.errorInDelete ) return cb( err );

                // That's all!
                cb( null, queryDocs, total, grandTotal );
              }
215910
function onError(err) {
    if (!retries.length) return reject(err);
    setTimeout(()=>fn().then(resolve, onError), retries.shift());
  }
668027
function(err) {
            Dialogs.alert("Error:", err.message || err);
            console.error(err.stack || err.message || err);
            return Q.reject(err);
        }
770149
function createError(status, message) {
  var err = new Error(message);
  err.status = status;
  return err;
}
265317
function enforce(err) {
    if (is.string(err)) err = new Error(err);
    err.message = err.message.replace(/^Error: /, '');

    return err;
}
524284
function error (response, status, message) {
  let e = new Error(`${status}: ${message}`)
  e.response = response
  e.status = status
  return e
}
1149831
function createError (err, src) {
  return { status: 'error', src: src, message: err, timestamp: Date.now() }
}
660398
function(err){
  //if this is already a network error just throw it
  if(err instanceof NetworkError){
    throw err
  }
  //convert strings to errors
  if('string' === typeof err){
    err = new Error(err)
  }
  //check if the error message matches a known TCP error
  var error
  for(var i = 0; i < tcpErrors.length; i++){
    if(err.message.indexOf(tcpErrors[i]) >= 0){
      //lets throw a NetworkError
      error = new NetworkError(err.message)
      //preserve the original stack trace so we can actually debug these
      error.stack = err.stack
      throw error
    }
  }
  //if we make it here it is not an error we can handle just throw it
  throw err
}
1193883
function getErrorSource (err) {
  let result

  try {
    const { fileName, lineNumber, columnNumber } = errorStackParser.parse(err).shift()
    result = `${fileName}:${lineNumber}:${columnNumber}`
  } catch (err) {}

  return result
}
311020
function rejectOnError(response, url) {
	const error = new Error(`${response.statusText} - status=${response.status}`);

	error.url = url;
	error.status = response.status;
	error.response = response.clone();

	debug( d => response.clone().text( text =>  d(`Response Error - url=${url}, text=${ text }`, response) ) );

	if (response.status === 422) {
		return response.json()
			.then( data => {
				error.validationErrors = data;

				throw error;
			})

		} else {
			return Store.reject(error);
		}
}
1229634
function(err) {
        if (err) this._onError(err);
        if (this._continueErrors || !err) {
            var args = [].slice.call(arguments);
            if (this._callbacks.length > 0) {
                this._isQueueRunning = true;
                var cb = this._callbacks.shift();
                cb = cb.bind(this);
                args = args.slice(1);
                args.push(this.next);
                cb.apply(this, args);

            } else {
                this._isQueueRunning = false;
                this.start = (function() {
                    this.start = null;
                    this.next.apply(this, args);
                }).bind(this);

            }
        }
        return this;
    }
700013
function RequestError(err, url) {
	VError.call(this, err, 'for url %s', url);
	this.name = RequestError.name;
}
126931
function _runError(error, module) {
  const _error = new emitter.Error({
    target:module.filename,
    source:(module.parent || module).filename,
    error
  });
  module.exports = _error;
  emitter.emit('error', _error);
  return (!!_error.ignore || (_error.ignore && isFunction(_error.ignore) && _error.ignore()));
}