[opt](load) catch Throwable to make load error msg more clear (#26821)

When doing LoadPendingTask or LoadLoadingTask, there may be some Error thrown,
such as `NoClassDefFoundError`, but previously, we only catch java's `Exception`, so
other kind of error can not be shown clearly.
This commit is contained in:
Mingyu Chen
2023-11-13 09:39:29 +08:00
committed by GitHub
parent 4230b8c36c
commit fa8c3aec07

View File

@ -91,10 +91,10 @@ public abstract class LoadTask extends MasterTask {
failMsg.setMsg(e.getMessage() == null ? "" : e.getMessage());
LOG.warn(new LogBuilder(LogKey.LOAD_JOB, callback.getCallbackId())
.add("error_msg", "Failed to execute load task").build(), e);
} catch (Exception e) {
failMsg.setMsg(e.getMessage() == null ? "" : e.getMessage());
} catch (Throwable t) {
failMsg.setMsg(t.getMessage() == null ? "" : t.getMessage());
LOG.warn(new LogBuilder(LogKey.LOAD_JOB, callback.getCallbackId())
.add("error_msg", "Unexpected failed to execute load task").build(), e);
.add("error_msg", "Unexpected failed to execute load task").build(), t);
} finally {
if (!isFinished) {
// callback on pending task failed