@Override public String getMessage() { String message = super.getMessage(); if (message == null && getCause() != null) { message = getCause().getMessage(); } if (message == null) { message = errorCode.getName(); } return message; } }
private void testInvalidAggregation(Long[] x, int n) { try { testAggregation(null, createLongArraysBlock(x), createLongRepeatBlock(n, x.length)); } catch (PrestoException e) { assertEquals(e.getErrorCode().getName(), INVALID_FUNCTION_ARGUMENT.name()); } }
private void testInvalidAggregation(Long[] x, int n) { try { testAggregation(new long[] {}, createLongsBlock(x), createLongRepeatBlock(n, x.length)); } catch (PrestoException e) { assertEquals(e.getErrorCode().getName(), INVALID_FUNCTION_ARGUMENT.name()); } }
private void testInvalidAggregation(Double[] x, int n) { try { testAggregation(new long[] {}, createDoublesBlock(x), createLongRepeatBlock(n, x.length)); } catch (PrestoException e) { assertEquals(e.getErrorCode().getName(), INVALID_FUNCTION_ARGUMENT.name()); } }
if (t instanceof PrestoException) { PrestoException e = (PrestoException) t; log.error("Error processing %s: %s: %s", split.getInfo(), e.getErrorCode().getName(), e.getMessage());
null, errorCode.getCode(), errorCode.getName(), errorCode.getType().toString(), failure.getErrorLocation(),
@Test public void testInvalidSessionError() { String invalidTimeZone = "this_is_an_invalid_time_zone"; Request request = preparePost().setHeader(PRESTO_USER, "user") .setUri(uriFor("/v1/statement")) .setBodyGenerator(createStaticBodyGenerator("show catalogs", UTF_8)) .setHeader(PRESTO_SOURCE, "source") .setHeader(PRESTO_CATALOG, "catalog") .setHeader(PRESTO_SCHEMA, "schema") .setHeader(PRESTO_PATH, "path") .setHeader(PRESTO_TIME_ZONE, invalidTimeZone) .build(); QueryResults queryResults = client.execute(request, createJsonResponseHandler(QUERY_RESULTS_CODEC)); while (queryResults.getNextUri() != null) { queryResults = client.execute(prepareGet().setUri(queryResults.getNextUri()).build(), createJsonResponseHandler(QUERY_RESULTS_CODEC)); } QueryError queryError = queryResults.getError(); assertNotNull(queryError); TimeZoneNotSupportedException expected = new TimeZoneNotSupportedException(invalidTimeZone); assertEquals(queryError.getErrorCode(), expected.getErrorCode().getCode()); assertEquals(queryError.getErrorName(), expected.getErrorCode().getName()); assertEquals(queryError.getErrorType(), expected.getErrorCode().getType().name()); assertEquals(queryError.getMessage(), expected.getMessage()); }
@EventField public String getErrorCodeName() { return errorCode == null ? null : errorCode.getName(); }
@Override public String getMessage() { String message = super.getMessage(); if (message == null && getCause() != null) { message = getCause().getMessage(); } if (message == null) { message = errorCode.getName(); } return message; } }
private void testInvalidAggregation(Long[] x, int n) { try { testAggregation(null, createLongArraysBlock(x), createLongRepeatBlock(n, x.length)); } catch (PrestoException e) { assertEquals(e.getErrorCode().getName(), INVALID_FUNCTION_ARGUMENT.name()); } }
private void testInvalidAggregation(Double[] x, int n) { try { testAggregation(new long[] {}, createDoublesBlock(x), createLongRepeatBlock(n, x.length)); } catch (PrestoException e) { assertEquals(e.getErrorCode().getName(), INVALID_FUNCTION_ARGUMENT.name()); } }
private void testInvalidAggregation(Long[] x, int n) { try { testAggregation(new long[] {}, createLongsBlock(x), createLongRepeatBlock(n, x.length)); } catch (PrestoException e) { assertEquals(e.getErrorCode().getName(), INVALID_FUNCTION_ARGUMENT.name()); } }
if (t instanceof PrestoException) { PrestoException e = (PrestoException) t; log.error("Error processing %s: %s: %s", split.getInfo(), e.getErrorCode().getName(), e.getMessage());
private static QueryError toQueryError(QueryInfo queryInfo) { FailureInfo failure = queryInfo.getFailureInfo(); if (failure == null) { QueryState state = queryInfo.getState(); if ((!state.isDone()) || (state == QueryState.FINISHED)) { return null; } log.warn("Query %s in state %s has no failure info", queryInfo.getQueryId(), state); failure = toFailure(new RuntimeException(format("Query is %s (reason unknown)", state))).toFailureInfo(); } ErrorCode errorCode; if (queryInfo.getErrorCode() != null) { errorCode = queryInfo.getErrorCode(); } else { errorCode = INTERNAL_ERROR.toErrorCode(); log.warn("Failed query %s has no error code", queryInfo.getQueryId()); } return new QueryError( failure.getMessage(), null, errorCode.getCode(), errorCode.getName(), toErrorType(errorCode.getCode()).toString(), failure.getErrorLocation(), failure); }