<p>parseErrors.</p>

@param exception a {@link java.lang.Throwable} object.
@param status a int.
@return a {@link java.util.List} object.
423124
public static List<Result.Error> parseErrors(Throwable exception, int status) {
        List<Result.Error> errors = Lists.newArrayList();
        if (status == 500 || status == 400) {
            Throwable cause = exception;
            while (cause != null) {
                StackTraceElement[] stackTraceElements = cause.getStackTrace();
                if (stackTraceElements != null && stackTraceElements.length > 0) {
                    Result.Error error = new Result.Error(
                            Hashing.murmur3_32().hashUnencodedChars(exception.getClass().getName()).toString(),
                            cause.getMessage());

                    if (status == 500) {
                        StringBuilder descBuilder = new StringBuilder();
                        for (StackTraceElement element : stackTraceElements) {
                            descBuilder
                                    .append(element.toString())
                                    .append("\n");
                        }

                        error.setDescription(descBuilder.toString());
                    }
                    StackTraceElement stackTraceElement = stackTraceElements[0];
                    String source = stackTraceElement.toString();
                    error.setSource(source);

                    errors.add(error);
                }
                cause = cause.getCause();
            }
        }

        return errors;
    }
1270141
@Nonnull
    protected Throwable getResponseException(Throwable e) {
        // Unwrap execution exceptions.
        if (ExecutionException.class.isAssignableFrom(e.getClass())) {
            return getResponseException(e.getCause());
        }
        return e;
    }
948058
public static ErrorMessage fromStatus(int status) {
        ErrorMessage errorMessage = new ErrorMessage();
        errorMessage.setStatus(status);
        errorMessage.setMessage(parseMessage(status));
        errorMessage.setDescription(parseDescription(status));
        return errorMessage;
    }
827043
public void throwOnError() throws ParseException {
        for (ParseError e : getProblemCollector()) {
            if (e.getSeverity() == ParseError.Severity.ERROR) {
                throw ParseException.create(getProblemCollector());
            }
        }
    }
840617
@SafeVarargs
    public final Builder retryOn(Class<? extends Exception>... exceptions) {
      for (Class<? extends Exception> exception : exceptions) {
        retriableExceptions.add(checkNotNull(exception));
      }
      return this;
    }
972088
protected void skipResponseStatusExceptionParsing(String json) throws ResponseErrorJsonParsingException {
    // If this is not an object, it's not an error response.
    if (!json.startsWith("{")) {
      throw new ResponseErrorJsonParsingException();
    }

    int subStrEnd = Math.min(50, json.length());
    if (!json.substring(0, subStrEnd).contains("\"error\"")) {
      throw new ResponseErrorJsonParsingException();
    }
  }
314983
public static Status fromThrowable(Throwable t) {
        requireNonNull(t, "t");

        Throwable cause = t;
        while (cause != null) {
            if (cause instanceof ArmeriaStatusException) {
                t = StatusExceptionConverter.toGrpc((ArmeriaStatusException) cause);
                break;
            }
            cause = cause.getCause();
        }

        final Status s = Status.fromThrowable(t);
        if (s.getCode() != Code.UNKNOWN) {
            return s;
        }
        if (t instanceof StreamException) {
            final StreamException streamException = (StreamException) t;
            if (streamException.getMessage() != null && streamException.getMessage().contains("RST_STREAM")) {
                return Status.CANCELLED;
            }
        }
        if (t instanceof ClosedChannelException) {
            // ClosedChannelException is used any time the Netty channel is closed. Proper error
            // processing requires remembering the error that occurred before this one and using it
            // instead.
            return Status.UNKNOWN.withCause(t);
        }
        if (t instanceof IOException) {
            return Status.UNAVAILABLE.withCause(t);
        }
        if (t instanceof Http2Exception) {
            return Status.INTERNAL.withCause(t);
        }
        if (t instanceof TimeoutException) {
            return Status.DEADLINE_EXCEEDED.withCause(t);
        }
        return s;
    }
432898
public static Tag exception(@Nullable Throwable exception) {
        if (exception == null) {
            return EXCEPTION_NONE;
        }
        String simpleName = exception.getClass().getSimpleName();
        return Tag.of("exception", simpleName.isEmpty() ? exception.getClass().getName() : simpleName);
    }
86096
public static TStatus toTStatus(Exception e) {
    if (e instanceof HiveSQLException) {
      return ((HiveSQLException)e).toTStatus();
    }
    TStatus tStatus = new TStatus(TStatusCode.ERROR_STATUS);
    tStatus.setErrorMessage(e.getMessage());
    tStatus.setInfoMessages(toString(e));
    return tStatus;
  }
1264284
public void addException(Exception exception) {
        LOGGER.log(Level.FINE, "Adding exception", exception);
        exceptionsToPublish.add(exception);
    }
645098
public static Exception getLowestException(final Exception exception, final String exceptionPrefix) {

		if (exception == null) {
			return null;
		}

		Throwable nestedException = (Throwable) exception;
		Exception lastLowException = null;
		while (nestedException != null) {
			if (nestedException.getClass().toString().startsWith("class " + exceptionPrefix)) {
				lastLowException = (Exception) nestedException;
			}

			nestedException = getInnerException(nestedException);
		}

		return lastLowException;
	}
132981
public static ParseException create(List<ParseError> errors) {
        if (errors.size() == 1) {
            return new ParseException(errors.get(0).getMessage(), errors);
        } else if (errors.size() > 1) {
            return new ParseException(String.format("%d errors occured. First: %s",
                                                    errors.size(),
                                                    errors.get(0).getMessage()), errors);
        } else {
            return new ParseException("An unknown error occured", errors);
        }
    }
608359
@Expose
    protected List<Exception> getExceptions() {
        List<Exception> exceptions = new ArrayList<Exception>();
        exceptions.add(exception);

        Throwable currentThrowable = exception.getThrowable().getCause();
        while (currentThrowable != null) {
            exceptions.add(new Exception(config, currentThrowable));
            currentThrowable = currentThrowable.getCause();
        }

        return exceptions;
    }
507610
private void errorIf(ClientResponse response,
            ClientResponse.Status[] status, boolean bool)
            throws ClientException {
        ClientResponse.Status clientResponseStatus
                = response.getClientResponseStatus();
        if (bool) {
            if (contains(status, clientResponseStatus)) {
                String message = response.getEntity(String.class);
                throw new ClientException(clientResponseStatus, message);
            }
        } else if (!contains(status, clientResponseStatus)) {
            String message = response.getEntity(String.class);
            throw new ClientException(clientResponseStatus, message);
        }
    }
836584
protected int statusCodeForException(@Nonnull Throwable exception) {
        if (exception instanceof PApplicationException) {
            PApplicationException e = (PApplicationException) exception;
            if (e.getId() == PApplicationExceptionType.INVALID_PROTOCOL ||
                e.getId() == PApplicationExceptionType.PROTOCOL_ERROR ||
                e.getId() == PApplicationExceptionType.BAD_SEQUENCE_ID ||
                e.getId() == PApplicationExceptionType.INVALID_MESSAGE_TYPE) {
                return HttpServletResponse.SC_BAD_REQUEST;
            }
            if (e.getId() == PApplicationExceptionType.UNKNOWN_METHOD) {
                return HttpServletResponse.SC_NOT_FOUND;
            }
        }
        return HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
    }
1304345
protected HyperionException readException(Response response) throws IOException
    {
        ErrorResponse errorResponse = null;
        try
        {
            errorResponse = objectMapper.readValue(response.body().byteStream(), ErrorResponse.class);
        }
        catch (Exception ignore)
        {
        }

        HyperionException resolvedException = null;
        if (errorResponse != null)
        {
            try
            {
                Class exceptionClass = Class.forName(errorResponse.getType());
                resolvedException = (HyperionException) exceptionClass.getConstructor(String.class)
                        .newInstance(errorResponse.getMessage());
            }
            catch (Throwable ignore)
            {
            }

            if (resolvedException == null)
            {
                resolvedException =
                        new HyperionException(errorResponse.getStatusCode(), errorResponse.getMessage());
            }

            resolvedException.setErrorDetails(errorResponse.getErrorDetails());
            resolvedException.setErrorTime(errorResponse.getErrorTime());
            resolvedException.setRequestId(errorResponse.getRequestId());
        }

        if (resolvedException == null)
        {
            resolvedException =
                    new HyperionException(response.code(), response.message());
        }

        return resolvedException;

    }
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) {

        }
    }