Constructs server exception with FTPReplyParseException
nested in it.
436004
public static ServerException embedFTPReplyParseException(
					        FTPReplyParseException rpe,
						String message) {
	ServerException se = new ServerException(
						 WRONG_PROTOCOL,
						 message);
	se.setRootCause(rpe);
	return se;
    }
1271274
public static ServerException embedUnexpectedReplyCodeException(
			       		    UnexpectedReplyCodeException urce,
					    String message) {
	ServerException se = new ServerException(
						 SERVER_REFUSED,
						 message);
	se.setRootCause(urce);
	return se;
    }
827043
public void throwOnError() throws ParseException {
        for (ParseError e : getProblemCollector()) {
            if (e.getSeverity() == ParseError.Severity.ERROR) {
                throw ParseException.create(getProblemCollector());
            }
        }
    }
997120
private SAXParseException makeException (String message)
    {
    if (locator != null) {
        return new SAXParseException(message, locator);
    } else {
        return new SAXParseException(message, null, null, -1, -1);
    }
    }
507749
final public void FloatingPoint() throws ParseException {
                                       /*@bgen(jjtree) FloatingPoint */
                                        AstFloatingPoint jjtn000 = new AstFloatingPoint(JJTFLOATINGPOINT);
                                        boolean jjtc000 = true;
                                        jjtree.openNodeScope(jjtn000);Token t = null;
    try {
      t = jj_consume_token(FLOATING_POINT_LITERAL);
                                 jjtree.closeNodeScope(jjtn000, true);
                                 jjtc000 = false;
                                 jjtn000.setImage(t.image);
    } finally {
      if (jjtc000) {
        jjtree.closeNodeScope(jjtn000, true);
      }
    }
  }
299471
public static String formatException(Throwable exception) {
		StringBuilder buffer = new StringBuilder();

		formatException(exception, buffer);

		return buffer.toString();
	}
1212987
private SQLException readErrorPacket(Buffer buffer, Results results) {
    removeHasMoreResults();
    this.hasWarnings = false;
    buffer.skipByte();
    final int errorNumber = buffer.readShort();
    String message;
    String sqlState;
    if (buffer.readByte() == '#') {
      sqlState = new String(buffer.readRawBytes(5));
      message = buffer.readStringNullEnd(StandardCharsets.UTF_8);
    } else {
      // Pre-4.1 message, still can be output in newer versions (e.g with 'Too many connections')
      buffer.position -= 1;
      message = new String(buffer.buf, buffer.position, buffer.limit - buffer.position,
          StandardCharsets.UTF_8);
      sqlState = "HY000";
    }
    results.addStatsError(false);

    //force current status to in transaction to ensure rollback/commit, since command may have issue a transaction
    serverStatus |= ServerStatus.IN_TRANSACTION;

    removeActiveStreamingResult();
    return new SQLException(message, sqlState, errorNumber);
  }
884396
function parseException(exception) {
        function createErroniusDevice(dt, ct, ip, port, errorCode, errorMessage) {
            return {
                'dt': dt,
                'dtString': driver_const.DRIVER_DEVICE_TYPE_NAMES[dt],
                'dtName': driver_const.DEVICE_TYPE_NAMES[dt],

                'ct': ct,
                'ctString': driver_const.DRIVER_CONNECTION_TYPE_NAMES[ct],
                'ctName': driver_const.CONNECTION_TYPE_NAMES[ct],

                'ip': ip,
                'port': port,

                'errorCode': exception.errorCode,
                'errorMessage': exception.errorMessage,

                'includeError': true,
            };
        }

        try {
            // console.log('Exception', exception);

            var errorCode = exception.errorCode;
            var errorMessage = exception.errorMessage;

            var erroniusDev = null;
            try {
                var deviceHints = exception.initFailure.deviceHints;
                // console.log('Device Hints', deviceHints);

                var dt = driver_const.deviceTypes[deviceHints.knownDeviceType];
                var ip = deviceHints.ip;
                var port = deviceHints.port;
                var ct = driver_const.connectionTypes[deviceHints.initProtocol];
                if(ct == driver_const.LJM_CT_UDP && port == driver_const.LJM_WIFI_UDP_PORT) {
                    ct = driver_const.LJM_CT_WIFI_UDP;
                } else if(ct == driver_const.LJM_CT_UDP && port == driver_const.LJM_ETH_UDP_PORT) {
                    ct = driver_const.LJM_CT_ETHERNET_UDP;
                }

                if(typeof(exception.initFailure.deviceHints.discovered) !== 'undefined') {
                    if(exception.initFailure.deviceHints.discovered) {
                        erroniusDev = createErroniusDevice(
                            dt, ct, ip, port, errorCode, errorMessage
                        );
                    }
                }
            }
            catch(err) {
                var dev = exception.device;
                // console.log('Error device', dev);
                erroniusDev = createErroniusDevice(
                    driver_const.deviceTypes[dev.deviceType],
                    driver_const.connectionTypes[dev.ljmConnectionType],
                    dev.ip,
                    dev.port,
                    errorCode,
                    errorMessage
                );
            }

            // if(errorCodesToReport.indexOf(exception.errorCode) >= 0) {
            if(erroniusDev.includeError) {
                // console.log('Saved Exception', exception);
                erroniusDevices.push(erroniusDev);
            }
        } catch(err) {

        }
    }
1110958
public void propagateAsErrorIfCancelException(final Throwable t) {
    if ((t instanceof OperationCanceledError)) {
      throw ((OperationCanceledError)t);
    }
    final RuntimeException opCanceledException = this.getPlatformOperationCanceledException(t);
    if ((opCanceledException != null)) {
      throw new OperationCanceledError(opCanceledException);
    }
  }
1043760
private static String formatParseExceptionDetails(
      String errorToken, List<String> expectedTokens) {
    // quotes/normalize the expected tokens before rendering, just in case after normalization some
    // can be deduplicated.
    ImmutableSet.Builder<String> normalizedTokensBuilder = ImmutableSet.builder();
    for (String t : expectedTokens) {
      normalizedTokensBuilder.add(maybeQuoteForParseError(t));
    }
    expectedTokens = normalizedTokensBuilder.build().asList();

    StringBuilder details = new StringBuilder();
    int numExpectedTokens = expectedTokens.size();
    if (numExpectedTokens != 0) {
      details.append(": expected ");
      for (int i = 0; i < numExpectedTokens; i++) {
        details.append(expectedTokens.get(i));
        if (i < numExpectedTokens - 2) {
          details.append(", ");
        }
        if (i == numExpectedTokens - 2) {
          if (numExpectedTokens > 2) {
            details.append(',');
          }
          details.append(" or ");
        }
      }
    }

    return String.format(
        "parse error at '%s'%s", escapeWhitespaceForErrorPrinting(errorToken), details.toString());
  }
273168
@Override
    public void throwParseError(String format, Object arg, Object arg2)
        throws XMLStreamException
    {
        String msg = (arg != null || arg2 != null) ?
            MessageFormat.format(format, new Object[] { arg, arg2 }) : format;
        throw constructWfcException(msg);
    }
118540
@Override
    protected void throwStreamException(String msg, Location loc)
        throws XMLStreamException
    {
        if (loc == null) {
            throw new WstxParsingException(msg);
        }
        throw new WstxParsingException(msg, loc);
    }
1233338
protected function _parseException() {
        $this->_content = preg_replace('#' . preg_quote('; ?>; ?>') . '#isU', '; ?>', $this->_content);
        $this->_content = preg_replace('#' . preg_quote('<?php echo <?php') . '#isU', '<?php echo', $this->_content);
    }
1270647
function parseError(error: Error | string | string[]): StackFrame[] {
  if (error == null) {
    throw new Error('You cannot pass a null object.')
  }
  if (typeof error === 'string') {
    return parseStack(error.split('\n'))
  }
  if (Array.isArray(error)) {
    return parseStack(error)
  }
  if (typeof error.stack === 'string') {
    return parseStack(error.stack.split('\n'))
  }
  throw new Error('The error you provided does not contain a stack trace.')
}
486469
def formatException(type, value, tb):
    

    # Absolute paths to site-packages
    packages = tuple(join(abspath(p), "") for p in sys.path[1:])

    # Highlight lines not referring to files in site-packages
    lines = []
    for line in format_exception(type, value, tb):
        matches = re.search(r"^  File \"([^\"]+)\", line \d+, in .+", line)
        if matches and matches.group(1).startswith(packages):
            lines += line
        else:
            matches = re.search(r"^(\s*)(.*?)(\s*)$", line, re.DOTALL)
            lines.append(matches.group(1) + colored(matches.group(2), "yellow") + matches.group(3))
    return "".join(lines).rstrip()
1168510
@Override
	public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {

		if (cause instanceof TransportException) {
			notifyAllChannelsOfErrorAndClose(cause);
		}
		else {
			final SocketAddress remoteAddr = ctx.channel().remoteAddress();

			final TransportException tex;

			// Improve on the connection reset by peer error message
			if (cause instanceof IOException
					&& cause.getMessage().equals("Connection reset by peer")) {

				tex = new RemoteTransportException(
						"Lost connection to task manager '" + remoteAddr + "'. This indicates "
								+ "that the remote task manager was lost.", remoteAddr, cause);
			}
			else {
				SocketAddress localAddr = ctx.channel().localAddress();
				tex = new LocalTransportException(
					String.format("%s (connection to '%s')", cause.getMessage(), remoteAddr),
					localAddr,
					cause);
			}

			notifyAllChannelsOfErrorAndClose(tex);
		}
	}
1285432
private void tryHandleException(HttpCallContext ctx,
	                                HttpServletResponse response,
	                                Throwable t) throws ServletException, IOException, RuntimeException, Error
	{
		if (suppressClientAbortExceptions && t instanceof UnhandledException && t.getCause() != null)
		{
			// Only look 20 exceptions deep
			int maxDepth = 20;
			Throwable cause = t.getCause();

			while (cause != null && --maxDepth > 0)
			{
				if (cause.getClass().getName().equals("org.apache.catalina.connector.ClientAbortException"))
				{
					ignoredAborts.mark();

					if (log.isTraceEnabled())
						log.trace("Client aborted during request. Ignoring. Detail: " + ctx.getRequestInfo(), t);

					return;
				}
				else
				{
					cause = cause.getCause();
				}
			}
		}

		log.warn("Failure during " + ctx.getRequestInfo(), t);

		// If the response is already committed we can't render the exception elegantly
		if (response.isCommitted())
			rethrow(t);

		try
		{
			RestFailureMarshaller marshaller = new RestFailureMarshaller();
			RestFailure failure = marshaller.renderFailure(t);

			TwitterBootstrapRestFailurePageRenderer renderer = new TwitterBootstrapRestFailurePageRenderer(failure);

			response.setStatus(500); // internal error

			// Render the HTML
			final StringBuilder sb = new StringBuilder(4096);
			renderer.writeHTML(sb);

			response.getWriter().print(sb);
		}
		catch (Throwable newException)
		{
			log.warn("Error trying to present exception elegantly: ", newException);

			// Rethrow the original exception, it's not our problem anymore
			rethrow(t);
		}
	}