Creates an error handler. The handler displays the error message if there is one,
or displays the help if there ie no error or it is a usage error.
@param {object} yargs
@returns {function(err)} the error handler function
545806
function createErrorHandler(yargs) {
	if (!yargs) {
		yargs = Yargs;
	}
	return consoleErrorLogger.bind(undefined, console, yargs, true);
}
1149831
function createError (err, src) {
  return { status: 'error', src: src, message: err, timestamp: Date.now() }
}
735650
function initStackdriverErrorReporter() {
  if (typeof window.StackdriverErrorReporter === 'function') {
    window.addEventListener('DOMContentLoaded', () => {
      const errorHandler = new window.StackdriverErrorReporter()
      errorHandler.start({
        key: firebase.apiKey,
        projectId: firebase.projectId,
        service: 'react-firebase-redux-site',
        version
      })
    })
  }
  return errorHandler
}
1320471
function makeError(jqXHR, textStatus, errorThrown, options) {
    var Constructor = statusToError[textStatus];

    // We did not find anything in the map, which would happen if the textStatus
    // was "error". Determine whether an ``HttpError`` or an ``AjaxError`` must
    // be thrown.
    if (!Constructor) {
      Constructor = statusToError[(jqXHR.status !== 0) ? "http" : "ajax"];
    }

    return new Constructor(jqXHR, textStatus, errorThrown, options);
  }
910722
function(err, req, res) {

  console.log('handle error:');
  console.dir(err);

  // uri error
  if (err instanceof URIError) {
    return res.status(404).render('errors/404');
  }

  logger.error(req.method + ' ' + getURL(req) + ' : ' + err);
  logger.error(err.stack);

  if (!res._headerSent) {
    // show error
    if (config.showerrstack) {
      //
      const stacktrace = [
        '<h1>', req.originalUrl, '</h1>',
        '<pre>', err.stack, '</pre>'
      ].join('');
      res.status(500).send(stacktrace);
    } else {
      res.status(500).render('errors/500');
    }
  }

  if (config.mailcrashto) {
    mailer.send('crash', {
      to:       config.mailcrashto,
      subject:  [ config.appname, 'Crash:', err ].join(' '),
      body:     formatMessage(req, err)
    })
  }
}
772782
function (err) {
    var msg = '';
    var t$ = Tool;
    try {
      if (t$.isString(err)) {
        msg = err;
      } else if (t$.isError(err)) {
        msg = err.message;
      } else if (t$.isObject(err)) {
        var errMsg = [];
        for (var p in err) {
          if (err.hasOwnProperty(p)) {
            errMsg.push(p + '=' + err[p]);
          }
        }
        if (errMsg.length === 0) {
          msg = err;
        } else {
          msg = errMsg.join('\n');
        }
      } else {
        msg += '[RTY_CANT_TYPE] = ' + t$.getType(err);
        msg += JSON.stringify(err);
      }
    } catch (error) {
      throw error
    }

    return msg
  }
678462
function createErrorHandler(verb) {
            return function(err) {
                if (!callback) { return; }
                grunt.verbose.error();
                grunt.fail.warn("Failed to " + verb + ": " + err.message);
                callbackOnce(err);
            };
        }
1103202
function catchClientError(req, res, next) {
  const { end } = res;

  res.end = function() {
    // console.log(`Catch client response : ${req.url} ${res.statusCode}`);
    const errorRoute = Route
      .routes('err')
      .filter((obj) => {
        return obj.extra.status === res.statusCode && obj.route !== req.url;
      });

    if(errorRoute.length > 0 && !isRedirect) {
      return redirect(errorRoute[0], req, res, next);
    }

    isRedirect = false;
    end.apply(res, arguments);
  };

  next();
}
257544
function errHandler(err) {
    /* istanbul ignore else */
    if (_output) {
      err = err instanceof Error ? err : new Error(err)
      _emitter.emit('end', err)
      _output = null
    }
    else
      console.error('jspreproc: ' + err)
  }
565575
def add_error_handlers(app):
    """"""

    def handle_validation_error(error):
        response = jsonify({'message': str(error)})
        response.status_code = error.status_code
        return response

    app.errorhandler(ValidationError)(handle_validation_error)
839813
function onerror(cb) {
  return function (err) {
    if (err) {
      shas = {}
      arguments[0] = err instanceof Error ? err : new Error(err.toString())
    }
    cb.apply(null, arguments)
  }
}
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);
    }
811748
function createExchangeErrorHandlerFor (exchange) {
  return function (err) {
    if (!exchange.options.confirm) return;

    // should requeue instead?
    // https://www.rabbitmq.com/reliability.html#producer
    debug && debug('Exchange error handler triggered, erroring and wiping all unacked publishes');
    for (var id in exchange._unAcked) {
      var task = exchange._unAcked[id];
      task.emit('ack error', err);
      delete exchange._unAcked[id];
    }
  };
}
907316
function errorPage(res, errMsg, publicMsg, useLayout) {
	if ( useLayout === undefined ) useLayout = true;
	console.log(errMsg);
	res.render('error', {
		layout: useLayout,
		errMsg: errMsg,
		publicMsg: publicMsg
	});			
}
1276157
function devserver(yargs) {
  var requirements = pathRequiredUsage(
    'Path to a staticbuild.json file or directory to find one.\n' +
    '                 If no path is supplied, the current directory is used.');
  
  yargs = configureYargs(yargs)
  .usage(commandUsage('dev', '[options] <path>' + requirements, 
    'Development server.\n\n' + 
    '    Runs a local http server to dynamically render static content ' + 
    'during development.'))
  .option('b', {
    alias: 'bundling',
    description: 'Enable bundling.',
    type: 'boolean',
    // jscs: disable
    'default': false
    // jscs: enable
  })
  .option('r', {
    alias: 'restart',
    description: 'Number of seconds to delay nodemon restarts. -1 to disable nodemon.',
    type: 'number',
    // jscs: disable
    'default': 1
    // jscs: enable
  })
  .help('h', 'Show help.').alias('h', 'help');
  yargs = configureVerbosity(yargs);

  var args = processYargs(yargs, 'dev');
  parseDevserverRestart(args);
  pathRequired(args, 1002);
  return args;
}
1195774
function errorHandler(err, req, res, next) {
    //important! this function has to have exactly four arguments defined
    //as its also used dirrectly by expressjs error handler in express/app.js
    const app = this;

    if (!(err instanceof Error)) {
        err = new ServiceError({
            message: `Got error of ${typeof err} type which is not instanceof Error`
        });
        return errorHandler.errorHandler.call(app, err, req, res);

    } else if (err instanceof RequestError) {
        if (err instanceof ServiceError) {
            //req.routeUID can be empty (eg. RouteNotFoundError)
            err.setOrigin(req.routeUID);
            err.setUID(req.UID);
            app.emit('error', err);
        }

        debug(err.stack);
        return app.emitAsyncSeries('error-response', err, res).catch(function(err) {
            app.emit('error', err);
        });
    // matches every error object which includes the Error.prototype
    // in it's prototype chain and at the same time the error object is not dirrect
    // instance of the Error
    } else if (Error.prototype.isPrototypeOf(Object.getPrototypeOf(err))) {
        if (app.listenerCount('unknown-error')) {
            return app.emit('unknown-error', err, function(error) {
                if (!(error instanceof RequestError)) {
                    error = ServiceError.buildFrom(error);
                }
                return errorHandler.errorHandler.call(app, error, req, res);
            });
        }
        return errorHandler.errorHandler.call(app, ServiceError.buildFrom(err), req, res);

    } else if (err instanceof Error) {
        return errorHandler.errorHandler.call(app, ServiceError.buildFrom(err), req, res);
    }
}
549662
function error( err, env ) {
	var msg = err.message;
	var out;

	msg += ' Environment variable: `' + env + '`.';
	if ( err instanceof TypeError ) {

		out = new TypeError( msg );
	}
	else if ( err instanceof RangeError ) {
		out = new RangeError( msg );
	}
	else {
		out = new Error( msg );
	}
	return out;
}