use of org.apache.hadoop.hive.ql.ErrorMsg in project hive by apache.
the class Hive method getHiveException.
private static HiveException getHiveException(Exception e, String msg, String logMsg) {
// The message from remote exception includes the entire stack. The error thrown from
// hive based on the remote exception needs only the first line.
String hiveErrMsg = null;
if (e.getMessage() != null) {
hiveErrMsg = String.format("%s%s%s", msg, ": ", Splitter.on(System.getProperty("line.separator")).split(e.getMessage()).iterator().next());
} else {
hiveErrMsg = msg;
}
ErrorMsg errorMsg = ErrorMsg.getErrorMsg(e);
if (logMsg != null) {
LOG.info(String.format(logMsg, e.getMessage()));
}
if (errorMsg != ErrorMsg.UNRESOLVED_RT_EXCEPTION) {
return new HiveException(e, e.getMessage(), errorMsg, hiveErrMsg);
} else {
return new HiveException(msg, e);
}
}
Aggregations