public static void throwUnsupportedHiveDataTypeError(String unsupportedType) { throw UserException.unsupportedError() .message(ERROR_MSG, unsupportedType) .build(logger); }
private static <T extends CompleteWork> void verify(final List<NodeEndpoint> endpoints, final List<T> units, final boolean condition, final String msg, Object... args) { if (!condition) { throw UserException.resourceError() .message(msg, args) .addContext("endpoints %s", endpoints) .addContext("workunits %s", units) .build(logger); } } }
/** * Builds an exception that can be thrown by the caller */ public RuntimeException build() { return b.build(logger); } }
private static final RpcException newRPCException(NodeEndpoint endpoint, IOException ioe) { UserRemoteException ure = UserRemoteException.create(UserException .ioExceptionError(ioe) .addIdentity(endpoint) .build(logger).getOrCreatePBError(false)); return new RpcException(ure); } @Test
@Override public void start() { if (throwAtStart) { ++numFailedStarts; throw UserException.resourceError().build(logger); } }
/** * Creates a new user exception builder . * * @see com.dremio.exec.proto.UserBitShared.DremioPBError.ErrorType#VALIDATION * @return user exception builder */ public static Builder validationError() { return validationError(null); }
/** * Creates a new user exception builder. * * @see com.dremio.exec.proto.UserBitShared.DremioPBError.ErrorType#CONNECTION * @return user exception builder */ public static Builder connectionError() { return connectionError(null); }
/** * creates a new user exception builder . * * @see com.dremio.exec.proto.UserBitShared.DremioPBError.ErrorType#PERMISSION * @return user exception builder */ public static Builder permissionError() { return permissionError(null); }
/** * Creates a new user exception builder . * * @see com.dremio.exec.proto.UserBitShared.DremioPBError.ErrorType#PLAN * @return user exception builder */ public static Builder planError() { return planError(null); }
/** * add a string line to the bottom of the context * @param value string line * @return this builder */ public Builder addContext(final String value) { context.add(value); return this; }
protected UserException(final DremioPBError.ErrorType errorType, final String message, final Throwable cause, final ByteString rawAdditionalContext) { super(message, cause); this.errorType = errorType; this.context = new UserExceptionContext(); this.rawAdditionalContext = rawAdditionalContext; }
/** * pushes a string value to the top of the context * * @param value context value * @return this builder */ public Builder pushContext(final String value) { context.push(value); return this; }
@Override public RecordWriter getRecordWriter(OperatorContext context, EasyWriter writer) throws IOException { throw UserException .unsupportedError() .message("Writing output in Avro format is not supported") .build(logger); }
@Override public void start() { if (throwAtStart) { throw UserException.resourceError().build(logger); } }
/** * add a string value to the bottom of the context * * @param name context name * @param value context value * @return this builder */ public Builder addContext(final String name, final String value) { context.add(name, value); return this; }
@Override public RecordWriter getRecordWriter(OperatorContext context, EasyWriter writer) throws IOException { throw UserException .unsupportedError() .message("Writing output in Excel format is not supported") .build(logger); }
@Override public int getWriterOperatorType() { throw UserException .unsupportedError() .message("Writing output in Excel format is not supported") .build(logger); } }
private static UserException unsup(String msg){ throw UserException.unsupportedError().message("Aggregate not supported. %s", msg).build(logger); } }
private static UserException unsup(String msg) { throw UserException.unsupportedError().message("Aggregate not supported. %s", msg).build(logger); } }
@Override public RelNode deserialize(String data) { throw UserException.unsupportedError().message("Kryo serializer doesn't support deserialization from JSON.").build(logger); }