Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Bruno Borges
2026-04-06 14:09:17 -04:00
parent 46f6f3e6db
commit 57b2799408
7 changed files with 50 additions and 37 deletions

View File

@@ -24,8 +24,14 @@ public class ErrorHandling {
session.close();
} catch (ExecutionException ex) {
System.err.println("Error: " + ex.getCause().getMessage());
ex.getCause().printStackTrace();
Throwable cause = ex.getCause();
Throwable error = cause != null ? cause : ex;
System.err.println("Error: " + error.getMessage());
error.printStackTrace();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
System.err.println("Interrupted: " + ex.getMessage());
ex.printStackTrace();
} catch (Exception ex) {
System.err.println("Error: " + ex.getMessage());
ex.printStackTrace();