/* Called from within a catch block to skip forward to a known token,
and report the occurred exception as a problem.
357833
TokenRange recover(int recoveryTokenType, ParseException p) {
        JavaToken begin = null;
        if (p.currentToken != null) {
            begin = token();
        }
        Token t;
        do {
            t = getNextToken();
        } while (t.kind != recoveryTokenType && t.kind != EOF);

        JavaToken end = token();

        TokenRange tokenRange = null;
        if (begin != null && end != null) {
            tokenRange = range(begin, end);
        }

        problems.add(new Problem(makeMessageForParseException(p), tokenRange, p));
        return tokenRange;
    }
827043
public void throwOnError() throws ParseException {
        for (ParseError e : getProblemCollector()) {
            if (e.getSeverity() == ParseError.Severity.ERROR) {
                throw ParseException.create(getProblemCollector());
            }
        }
    }
527823
@Override
    public void uncaughtException(Thread thread, Throwable thrown) {
        if (enabled) {
            logger.trace("Uncaught exception received.");

            EventBuilder eventBuilder = new EventBuilder()
                .withMessage(thrown.getMessage())
                .withLevel(Event.Level.FATAL)
                .withSentryInterface(new ExceptionInterface(thrown));

            try {
                Sentry.capture(eventBuilder);
            } catch (Exception e) {
                logger.error("Error sending uncaught exception to Sentry.", e);
            }
        }

        // taken from ThreadGroup#uncaughtException
        if (defaultExceptionHandler != null) {
            // call the original handler
            defaultExceptionHandler.uncaughtException(thread, thrown);
        } else if (!(thrown instanceof ThreadDeath)) {
            // CHECKSTYLE.OFF: RegexpSinglelineJava
            System.err.print("Exception in thread \"" + thread.getName() + "\" ");
            thrown.printStackTrace(System.err);
            // CHECKSTYLE.ON: RegexpSinglelineJava
        }
    }
995287
function(ex, options) {
        // If not an Error is passed through, recall as a message instead
        if (!(ex instanceof Error)) return Opbeat.captureMessage(ex, options);

        // Store the raw exception object for potential debugging and introspection
        lastCapturedException = ex;

        // TraceKit.report will re-raise any exception passed to it,
        // which means you have to wrap it in try/catch. Instead, we
        // can wrap it here and only re-raise if TraceKit.report
        // raises an exception different from the one we asked to
        // report on.
        try {
            TraceKit.report(ex, options);
        } catch(ex1) {
            if(ex !== ex1) {
                throw ex1;
            }
        }

        return Opbeat;
    }
837066
private void handleToken(String token) throws ParseException
    {
        currentToken = token;

        if (skipParsing)
        {
            cmd.addArg(token);
        }
        else if ("--".equals(token))
        {
            skipParsing = true;
        }
        else if (currentOption != null && currentOption.acceptsArg() && isArgument(token))
        {
            currentOption.addValueForProcessing(Util.stripLeadingAndTrailingQuotes(token));
        }
        else if (token.startsWith("--"))
        {
            handleLongOption(token);
        }
        else if (token.startsWith("-") && !"-".equals(token))
        {
            handleShortAndLongOption(token);
        }
        else
        {
            handleUnknownToken(token);
        }

        if (currentOption != null && !currentOption.acceptsArg())
        {
            currentOption = null;
        }
    }
96858
protected static void checkSkippedError(long skipped, int instead) throws IOException
    {
        if (skipped != instead)
        {
            throw new IOException(MESSAGE_SKIPPED + skipped + MESSAGE_BYTES_INSTEAD_OF + instead);
        }
    }
225176
void checkThrown() throws SSLException {
        synchronized (thrownLock) {
            if (thrown != null) {

                String msg = thrown.getMessage();

                if (msg == null) {
                    msg = "Delegated task threw Exception/Error";
                }

                /*
                 * See what the underlying type of exception is.  We should
                 * throw the same thing.  Chain thrown to the new exception.
                 */
                Exception e = thrown;
                thrown = null;

                if (e instanceof RuntimeException) {
                    throw (RuntimeException)
                        new RuntimeException(msg).initCause(e);
                } else if (e instanceof SSLHandshakeException) {
                    throw (SSLHandshakeException)
                        new SSLHandshakeException(msg).initCause(e);
                } else if (e instanceof SSLKeyException) {
                    throw (SSLKeyException)
                        new SSLKeyException(msg).initCause(e);
                } else if (e instanceof SSLPeerUnverifiedException) {
                    throw (SSLPeerUnverifiedException)
                        new SSLPeerUnverifiedException(msg).initCause(e);
                } else if (e instanceof SSLProtocolException) {
                    throw (SSLProtocolException)
                        new SSLProtocolException(msg).initCause(e);
                } else {
                    /*
                     * If it's SSLException or any other Exception,
                     * we'll wrap it in an SSLException.
                     */
                    throw (SSLException)
                        new SSLException(msg).initCause(e);
                }
            }
        }
    }
1164899
function reportIncorrectPlucking( ast, session ) {

    session.buildVisitor( {

        action( node ) {

            this.visit( node.expression, true );

        },

        labeled( node, action ) {

            if ( node.pick !== true ) return void 0;

            if ( action === true )

                session.error( `"@" cannot be used with an action block.`, node.location );

            if ( isSemanticPredicate( node ) )

                session.error( `"@" cannot be used on a semantic predicate.`, node.location );

            this.visit( node.expression );

        },

    } )( ast );

}
349605
void handleLoopException(Throwable t) {
        logger.warn("Unexpected exception in the selector loop.", t);

        // Prevent possible consecutive immediate failures that lead to
        // excessive CPU consumption.
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            // Ignore.
        }
    }
650400
def error(self, msg, previous=False):
        
        token = self.tokens[self.current_token - 1]
        line_no = self.line
        if previous:
            line_no -= 1
        line = self.raw[line_no]
        position = token["start"] - self.line_start
        if previous:
            position = len(line) + 2
        raise ParseException(msg, line, line_no + 1, position, token["value"])
973990
public void noExceptionThrown() {
    Throwable thrown = getSpecificationContext().getThrownException();
    if (thrown == null) return;
    throw new UnallowedExceptionThrownError(null, thrown);
  }
502668
public final void mTRAILING() throws RecognitionException {
		try {
			int _type = TRAILING;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// hql.g:65:10: ( 'trailing' )
			// hql.g:65:12: 'trailing'
			{
			match("trailing"); if (state.failed) return;

			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
786611
public void reportError(Throwable t) {
		// set the exception, if it is the first (and the exception is non null)
		if (t != null && exception.compareAndSet(null, t) && toInterrupt != null) {
			toInterrupt.interrupt();
		}
	}
72979
protected function processToken(): void
    {
        try {
            $this->checkAndRegisterSortingError();

            $this->checkAndRegisterLineBreakErrors();
        } catch (CodeWarning  $exception) {
            $fixable = $this->getExceptionHandler()->handleException($exception);

            if ($fixable) {
                $this->fixSorting();
            }
        }
    }
1084269
private void nextChunk() throws IOException {
        if (state == CHUNK_INVALID) {
            throw new MalformedChunkCodingException("Corrupt data stream");
        }
        try {
            chunkSize = getChunkSize();
            if (chunkSize < 0L) {
                throw new MalformedChunkCodingException("Negative chunk size");
            }
            state = CHUNK_DATA;
            pos = 0L;
            if (chunkSize == 0L) {
                eof = true;
                parseTrailerHeaders();
            }
        } catch (MalformedChunkCodingException ex) {
            state = CHUNK_INVALID;
            throw ex;
        }
    }
353837
private void checkTokenOrderIsCorrect(ESqlToken tokenTobeAdded) {

        switch (tokenTobeAdded) {

        case COLUMN:
            if (mPreviousToken != ESqlToken.CONDITION && mPreviousToken != ESqlToken.NOTHING) {
                throw new D6RuntimeException("AND or OR method is required at here." + " '" + mSgSQL.toString() + "'<==error occurred around here.");
            }
            break;

        case OPERATOR:
            if (mPreviousToken != ESqlToken.COLUMN) {
                throw new D6RuntimeException("VALUE is required at here." + " '" + mSgSQL.toString() + "'<==error occurred around here.");
            }
            break;

        case VALUE:
            if (mPreviousToken != ESqlToken.OPERATOR) {
                throw new D6RuntimeException("COLUMN or PROPERTY method is required at here." + " '" + mSgSQL.toString() + "'<==error occurred around here.");
            }
            break;

        case CONDITION:
            if (mPreviousToken != ESqlToken.VALUE && mPreviousToken != ESqlToken.WHERE) {
                throw new D6RuntimeException("VALUE is required at here." + " '" + mSgSQL.toString() + "'<==error occurred around here.");
            }
            break;

        case WHERE:
            if (mPreviousToken != ESqlToken.CONDITION && mPreviousToken != ESqlToken.NOTHING) {
                throw new D6RuntimeException("CONDITION is required at here." + " '" + mSgSQL.toString() + "'<==error occurred around here.");
            }
            break;
        default:
        }

        mPreviousToken = tokenTobeAdded;
    }
1244973
protected TokenCodes parseCRLFTokenExtract(WsByteBuffer buff, int log) throws MalformedMessageException {

        // if we're just starting, then skip leading white space characters
        // otherwise ignore them (i.e we might be in the middle of
        // "Mozilla/5.0 (Win"
        if (null == this.parsedToken) {
            if (!skipWhiteSpace(buff)) {
                return TokenCodes.TOKEN_RC_MOREDATA;
            }
        }
        int start = findCurrentBufferPosition(buff);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "parseCRLFTokenExtract: start:" + start
                         + " lim:" + this.byteLimit
                         + " pos:" + this.bytePosition);
        }
        TokenCodes rc = findCRLFTokenLength(buff);
        // Set the parsedToken from the token parsed from this ByteBuffer
        saveParsedToken(buff, start, TokenCodes.TOKEN_RC_DELIM.equals(rc), log);
        return rc;
    }