dbeaver/pro#10376 fix lost data in error (#4591)

This commit is contained in:
Ruslan Musaev
2026-08-24 08:59:10 +02:00
committed by GitHub
parent a68a29aeb0
commit 50f63caa4f
@@ -20,6 +20,7 @@ import graphql.ErrorClassification;
import graphql.ErrorType;
import graphql.GraphQLError;
import graphql.language.SourceLocation;
import org.jkiss.dbeaver.DBDatabaseException;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.sql.SQLState;
import org.jkiss.utils.CommonUtils;
@@ -147,10 +148,13 @@ public class DBWebException extends DBException implements GraphQLError {
return message;
}
}
Throwable rootCause = CommonUtils.getRootCause(cause);
String causeMessage = rootCause.getMessage();
// Preserve enriched web/database messages, but unwrap generic exceptions to their most specific cause.
Throwable messageCause = cause instanceof DBWebException || cause instanceof DBDatabaseException
? cause
: CommonUtils.getRootCause(cause);
String causeMessage = messageCause.getMessage();
if (CommonUtils.isEmpty(causeMessage)) {
causeMessage = rootCause.getClass().getSimpleName();
causeMessage = messageCause.getClass().getSimpleName();
}
if (CommonUtils.isEmpty(message)) {
return causeMessage;