Skip to content

Commit

Permalink
fix: Simplify exception truncation
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaufmann committed Feb 14, 2025
1 parent e80b0a9 commit 619fa2b
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ public class QueryExceptionHandler {
private static final int MAX_QUERY_LENGTH_IN_EXCEPTION = 16 * 1024;

public static DataCloudJDBCException createQueryException(String query, Exception e) {
String exceptionQuery = query;
if (exceptionQuery.length() > MAX_QUERY_LENGTH_IN_EXCEPTION) {
exceptionQuery = exceptionQuery.substring(0, MAX_QUERY_LENGTH_IN_EXCEPTION) + "<truncated>";
}
String exceptionQuery = query.length() > MAX_QUERY_LENGTH_IN_EXCEPTION
? query.substring(0, MAX_QUERY_LENGTH_IN_EXCEPTION) + "<truncated>"
: query;
return QueryExceptionHandler.createException("Failed to execute query: " + exceptionQuery, e);
}

Expand Down

0 comments on commit 619fa2b

Please sign in to comment.