check for default error messages and throw correct exception
342551
def _check_error_response(response, query):
        
        if "error" in response:
            http_error = ["HTTP request timed out.", "Pool queue is full"]
            geo_error = [
                "Page coordinates unknown.",
                "One of the parameters gscoord, gspage, gsbbox is required",
                "Invalid coordinate provided",
            ]
            err = response["error"]["info"]
            if err in http_error:
                raise HTTPTimeoutError(query)
            elif err in geo_error:
                raise MediaWikiGeoCoordError(err)
            else:
                raise MediaWikiException(err)
822523
def jsonify_error(message_or_exception, status_code=400):
    """"""
    if isinstance(message_or_exception, Exception):
        message = '%s: %s' % (
            message_or_exception.__class__.__name__, message_or_exception)
    else:
        message = message_or_exception

    logging.debug('Returning status=%s, error message: %s',
                  status_code, message)
    response = jsonify(error=message)
    response.status_code = status_code
    return response
1162395
def catch_exceptions(*exceptions):
    """"""
    def wrap(fn):
        @functools.wraps(fn)
        def wrapped_f(*args, **kwargs):
            try:
                return fn(*args, **kwargs)
            except exceptions:
                t, value, traceback = sys.exc_info()
                # If any resource does not exist, return None instead of raising
                if str(value.status) == '404':
                    return None
                e = CloudApiException(str(value), value.reason, value.status)
                raise_(CloudApiException, e, traceback)
        return wrapped_f
    return wrap
1252668
def raise_error(self, e, exc_info=None):
        """"""
        if not exc_info:
            exc_info = sys.exc_info()

        if not isinstance(e, InterfaceError):
            # allow python's built in errors to filter up through
            # https://docs.python.org/2/library/exceptions.html
            #if not hasattr(exceptions, e.__class__.__name__):
            if not hasattr(builtins, e.__class__.__name__):
                e = self._create_error(e, exc_info)

        reraise(e.__class__, e, exc_info[2])
916184
private static function catchError()
    {
        switch (json_last_error()) {
            case JSON_ERROR_NONE:
                self::$error = false;
                break;
            case JSON_ERROR_DEPTH:
                self::$error = 'Maximum stack depth exceeded';
                break;
            case JSON_ERROR_STATE_MISMATCH:
                self::$error = 'Underflow or the modes mismatch';
                break;
            case JSON_ERROR_CTRL_CHAR:
                self::$error = 'Unexpected control character found';
                break;
            case JSON_ERROR_SYNTAX:
                self::$error = 'Syntax error, malformed JSON';
                break;
            case JSON_ERROR_UTF8:
                self::$error = 'Malformed UTF-8 characters, possibly incorrectly encoded';
                break;
            default:
                self::$error = 'Unknown error';
                break;
        }
    }
619768
def ExceptionHook(exctype, value, tb):
    '''
    

    '''

    for line in traceback.format_exception_only(exctype, value):
        log.error(line.replace('\n', ''))
    for line in traceback.format_tb(tb):
        log.error(line.replace('\n', ''))
    sys.__excepthook__(exctype, value, tb)
371221
def handling_errors(self, all_errors_exit=False):
        """"""
        try:
            yield
        except SystemExit as err:
            self.exit(err.code)
        except BaseException:
            etype, value, tb = sys.exc_info()
            for _ in range(num_added_tb_layers):
                if tb is None:
                    break
                tb = tb.tb_next
            traceback.print_exception(etype, value, tb)
            if all_errors_exit:
                self.exit(1)
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);
    }
1176874
def error(self, msg):
        """"""
        print("***", msg, file=self.stdout)

        if not self.config.show_traceback_on_error:
            return

        etype, evalue, tb = sys.exc_info()
        if tb and tb.tb_frame.f_code.co_name == "default":
            tb = tb.tb_next
            if tb and tb.tb_frame.f_code.co_filename == "<stdin>":
                tb = tb.tb_next
                if tb:  # only display with actual traceback.
                    self._remove_bdb_context(evalue)
                    tb_limit = self.config.show_traceback_on_error_limit
                    fmt_exc = traceback.format_exception(
                        etype, evalue, tb, limit=tb_limit
                    )

                    # Remove last line (exception string again).
                    if len(fmt_exc) > 1 and fmt_exc[-1][0] != " ":
                        fmt_exc.pop()

                    print("".join(fmt_exc).rstrip(), file=self.stdout)
305361
function handleErrors(errorFormatter, response) {
  if (!response.ok) {
    if (errorFormatter) {
      return errorFormatter(response);
    }

    return defaultErrorFormatter(response);
  }
  return response;
}
140476
def assert_error(text, check, n=1):
    """"""
    assert_error.description = "No {} error for '{}'".format(check, text)
    assert(check in [error[0] for error in lint(text)])
165334
private static void checkErrors(Object object) throws GreenPepperServerException
    {
        if (object instanceof Exception)
        {
            throw new GreenPepperServerException(GreenPepperServerErrorKey.CALL_FAILED, ((Exception)object).getMessage());
        }
        
        if (object instanceof String)
        {
            String msg = (String)object;
            if (!StringUtils.isEmpty(msg) && msg.contains(GreenPepperServerErrorKey.ERROR))
            {
                String errorId = msg.replace(GreenPepperServerErrorKey.ERROR, "");
                
                throw new GreenPepperServerException(errorId, errorId);
            }
        }
    }
1360198
def _error(self, message, start, end=None):
        """"""
        raise errors.EfilterParseError(
            source=self.source, start=start, end=end, message=message)
927603
async function _expectErrorMessage(args, ...errorMessages) {
  expect.hasAssertions();
  try {
    await exec(getAntCommand(args));
    throw new Error('It is expected to throw some error');
  } catch (e) {
    const { code, stdout, stderr } = e;
    expect(code).toEqual(1);
    expect(stdout).toEqual('');
    for(const errorMessage of errorMessages) {
      expect(stderr).toContain(errorMessage);
    }
  }
}
687898
def _error_check(err, prefix=""):
    """"""
    if err != 0:
        err_str = _snd.sf_error_number(err)
        raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
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
1113174
private void checkForThreadErrors() throws IOException {
    if(error == true && childException != null) {
      error = false;
      IOException temp = childException;
      childException = null;
      throw temp;
    }
  }