Error handler

    RuntimeError or ValueError exceptions raised by commands will be handled
    by this function.
16106
def on_error(e):  # pragma: no cover
    
    exname = {'RuntimeError': 'Runtime error', 'Value Error': 'Value error'}
    sys.stderr.write('{}: {}\n'.format(exname[e.__class__.__name__], str(e)))
    sys.stderr.write('See file slam_error.log for additional details.\n')
    sys.exit(1)
713567
private void handleError(final String errorMessage) {
		
		failed = true;
		
		switch (errorPolicy) {
		case LOG_ONLY:
			logger.error(errorMessage);
			break;
			
		case RUNTIME_EXCEPTION:
			throw new RuntimeException(errorMessage);

		default:
			logger.error("Got error {} but unkown error policy {}", errorMessage, errorPolicy);
			break;
		}
	}
989912
def error_handler(f):
    """"""
    @wraps(f)
    def inner(*args, **kwargs):
        try:
            return f(*args, **kwargs)
        except NoResultFound:
            abort(404)
        except IntegrityError:
            abort(500)
    return inner
381650
function error(exception) {
		if (typeof customErrorHandler === 'function') {
			customErrorHandler(exception);
			return;
		}
		if (globalConfig.debug) {
			throw exception;
		} else {
			application.fire('error', {
				exception: exception
			});
		}
	}
782
public function handleError()
    {
        // get error info
        list ($errno, $message, $file, $line) = func_get_args();

        // construct error message
        $msg = "ERROR ($errno): $message";
        if ($line !== null) {
            $file = "$file:$line";
        }

        if ($file !== null) {
            $msg .= " [$file]";
        }

        static::$lastErrno = $errno;

        // throw the exception
        throw new RuntimeException($msg, $errno);
    }
427300
def exception_handler(exctype, value, traceback):
    
    if exctype == KeyboardInterrupt:
        pypro.console.out('')  # Adds a new line after Ctrl+C character
        pypro.console.err('Canceled')
    elif exctype == PyproException:
        pypro.console.err('[Error] ', value.message)
        exit()
    else:
        sys.__excepthook__(exctype, value, traceback)
580100
function handleError(err) {
  if (typeof err === 'string' && errors[err]) {
    console.error(errors[err]);
  } else {
    if (argv.verbose) {
      console.error(err.stack);
    } else {
      console.error(err.message);
    }
  }
  process.exit(1);
}
24803
function handleError(call, error) {
  var statusMetadata = new Metadata();
  var status = {
    code: constants.status.UNKNOWN,
    details: 'Unknown Error'
  };
  if (error.hasOwnProperty('message')) {
    status.details = error.message;
  }
  if (error.hasOwnProperty('code') && Number.isInteger(error.code)) {
    status.code = error.code;
    if (error.hasOwnProperty('details')) {
      status.details = error.details;
    }
  }
  if (error.hasOwnProperty('metadata')) {
    statusMetadata = error.metadata;
  }
  status.metadata = statusMetadata._getCoreRepresentation();
  var error_batch = {};
  if (!call.metadataSent) {
    error_batch[grpc.opType.SEND_INITIAL_METADATA] =
        (new Metadata())._getCoreRepresentation();
  }
  error_batch[grpc.opType.SEND_STATUS_FROM_SERVER] = status;
  call.startBatch(error_batch, function(){});
}
892679
def setValidityErrorHandler(self, err_func, warn_func, arg=None):
        
        libxml2mod.xmlRelaxNGSetValidErrors(self._o, err_func, warn_func, arg)
1332098
def _defaultErrorHandler(varBinds, **context):
        """"""
        errors = context.get('errors')

        if errors:
            err = errors[-1]
            raise err['error']
856977
function handleError(reject) {
  return (e) => {
    // prevent global error throw https://bugzilla.mozilla.org/show_bug.cgi?id=872873
    if (typeof e.preventDefault === 'function') e.preventDefault()
    reject(e.target.error)
  }
}
202688
def raise_exception(self, node, exc=None, msg='', expr=None,
                        lineno=None):
        """"""
        if self.error is None:
            self.error = []
        if expr is None:
            expr = self.expr
        if len(self.error) > 0 and not isinstance(node, ast.Module):
            msg = '%s' % msg
        err = ExceptionHolder(node, exc=exc, msg=msg, expr=expr, lineno=lineno)
        self._interrupt = ast.Break()
        self.error.append(err)
        if self.error_msg is None:
            self.error_msg = "at expr='%s'" % (self.expr)
        elif len(msg) > 0:
            self.error_msg = msg
        if exc is None:
            try:
                exc = self.error[0].exc
            except:
                exc = RuntimeError
        raise exc(self.error_msg)
141781
@Override
  protected void handleError(Suppressible s, Throwable t) {
    if (t instanceof ErrorProneError) {
      throw (ErrorProneError) t;
    }
    if (t instanceof CompletionFailure) {
      throw (CompletionFailure) t;
    }
    TreePath path = getCurrentPath();
    throw new ErrorProneError(
        s.canonicalName(),
        t,
        (DiagnosticPosition) path.getLeaf(),
        path.getCompilationUnit().getSourceFile());
  }
532349
def setValidityErrorHandler(self, err_func, warn_func, arg=None):
        
        libxml2mod.xmlSchemaSetValidErrors(self._o, err_func, warn_func, arg)
1281109
def handle_error(self, type_, value, tb):
        
        if not issubclass(type_, pywsgi.GreenletExit):
            self.server.loop.handle_error(self.environ, type_, value, tb)
        if self.response_length:
            self.close_connection = True
        else:
            tb_stream = traceback.format_exception(type_, value, tb)
            del tb
            tb_stream.append('\n')
            tb_stream.append(pprint.pformat(self.environ))
            body = ''.join(tb_stream)
            headers = pywsgi._INTERNAL_ERROR_HEADERS[:]
            headers[2] = ('Content-Length', str(len(body)))

            self.start_response(pywsgi._INTERNAL_ERROR_STATUS, headers)
            self.write(body)
372311
def handle_command_error(self, command, args, exc):
        
        verbosity = self.command_error_verbosity
        if verbosity == 'traceback':
            self.pretty_print_exc(command, exc, show_traceback=True)
        elif verbosity == 'debug':
            pdb.set_trace()
        elif verbosity == 'raise':
            raise exc
        elif verbosity == 'pretty':
            self.pretty_print_exc(command, exc)
        else:
            raise ValueError('Unexpected exception_verbosity: %s' %
                             verbosity)
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);
    }
  }
}