18.5 处理消息异常
@MessageExceptionHandler
public void handleExceptions(Throwable t) {
logger.error("Error handling message: " + t.getMessage());
}@MessageExceptionHandler(SpittleException.class)
public void handleExceptions(Throwable t) {
logger.error("Error handling message: " + t.getMessage());
}@MessageExceptionHandler({SpittleException.class, DatabaseException.class})
public void handleExceptions(Throwable t) {
logger.error("Error handling message: " + t.getMessage());
}@MessageExceptionHandler(SpittleException.class)
@SendToUser("/queue/errors")
public SpittleException handleExceptions(SpittleException e) {
logger.error("Error handling message: " + e.getMessage());
return e
}Last updated