@Override public String getVerboseMessage(boolean includeErrorIdAndIdentity) { StringBuilder sb = new StringBuilder(); sb.append(error.getMessage()); if (error.getContextCount() > 0) { sb.append("\n\n"); for (String context : error.getContextList()) { sb.append(context).append("\n"); } } if (error.hasException()) { sb.append("\n"); for (UserBitShared.StackTraceElementWrapper stackLine : error.getException().getStackTraceList()) { sb.append(stackLine.getClassName()) .append("(") .append(stackLine.getFileName()) .append(":") .append(stackLine.getLineNumber()) .append(")\n"); } } return sb.toString(); }
private ServerMeta getServerMeta() throws SQLException { assert getServerMetaSupported(); if (serverMeta == null) { synchronized(this) { if (serverMeta == null) { DremioConnection connection = (DremioConnection) getConnection(); try { GetServerMetaResp resp = connection.getClient().getServerMeta().get(); if (resp.getStatus() != RequestStatus.OK) { DremioPBError error = resp.getError(); throw new SQLException("Error when getting server meta: " + error.getMessage()); } serverMeta = resp.getServerMeta(); convertSupport = SQLConvertSupport.toSQLConvertSupport(serverMeta.getConvertSupportList()); } catch (InterruptedException e) { throw new SQLException("Interrupted when getting server meta", e); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause == null) { throw new AssertionError("Something unknown happened", e); } Throwables.propagateIfPossible(cause); throw new SQLException("Error when getting server meta", cause); } } } } return serverMeta; }
final String errMsgFromServer = resp.getError() != null ? resp.getError().getMessage() : "";
throw new SQLException("Failure getting metadata: " + error.getMessage());
public void writeTo(io.protostuff.Output output, com.dremio.exec.proto.UserBitShared.DremioPBError message) throws java.io.IOException { if(message.hasErrorId()) output.writeString(1, message.getErrorId(), false); if(message.hasEndpoint()) output.writeObject(2, message.getEndpoint(), com.dremio.exec.proto.SchemaCoordinationProtos.NodeEndpoint.WRITE, false); if(message.hasErrorType()) output.writeEnum(3, message.getErrorType().getNumber(), false); if(message.hasMessage()) output.writeString(4, message.getMessage(), false); if(message.hasException()) output.writeObject(5, message.getException(), com.dremio.exec.proto.SchemaUserBitShared.ExceptionWrapper.WRITE, false); for(com.dremio.exec.proto.UserBitShared.ParsingError parsingError : message.getParsingErrorList()) output.writeObject(6, parsingError, com.dremio.exec.proto.SchemaUserBitShared.ParsingError.WRITE, true); if(message.hasOriginalMessage()) output.writeString(1001, message.getOriginalMessage(), false); for(String context : message.getContextList()) output.writeString(1002, context, true); if(message.hasTypeSpecificContext()) output.writeByteArray(1003, message.getTypeSpecificContext().toByteArray(), false); } public boolean isInitialized(com.dremio.exec.proto.UserBitShared.DremioPBError message)
@Test public void testUpdateErrorType() throws Exception { RpcCompatibilityEncoder encoder = new RpcCompatibilityEncoder(); ChannelHandlerContext context = mock(ChannelHandlerContext.class); DremioPBError error = DremioPBError.newBuilder() .setErrorType(ErrorType.IO_EXCEPTION) .setMessage("test message") .build(); OutboundRpcMessage message = new OutboundRpcMessage(RpcMode.RESPONSE_FAILURE, RpcType.RESP_QUERY_PROFILE, 12, error); List<Object> out = new ArrayList<>(); encoder.encode(context, message, out); assertEquals(1, out.size()); OutboundRpcMessage received = (OutboundRpcMessage) out.get(0); assertEquals(RpcMode.RESPONSE_FAILURE, received.mode); assertEquals(12, received.coordinationId); DremioPBError newError = (DremioPBError) received.pBody; assertEquals(ErrorType.RESOURCE, newError.getErrorType()); assertEquals("test message", newError.getMessage()); }
@Test public void testBuildUserExceptionWithUserExceptionCauseAndMessage() { String messageA = "Test message A"; String messageB = "Test message B"; UserException original = UserException.connectionError().message(messageA).build(logger); UserException uex = UserException.dataWriteError(wrap(original, 5)).message(messageB).build(logger); //builder should return the unwrapped original user exception and not build a new one Assert.assertEquals(original, uex); DremioPBError error = uex.getOrCreatePBError(false); Assert.assertEquals(messageA, uex.getOriginalMessage()); Assert.assertFalse(error.getMessage().contains(messageB)); // messageB should not be part of the context }
@Override public String getMessage() { return error.getMessage(); }
/** * <code>optional string message = 4;</code> */ public Builder clearMessage() { bitField0_ = (bitField0_ & ~0x00000008); message_ = getDefaultInstance().getMessage(); onChanged(); return this; } /**