Skip to content

Commit 6e89179

Browse files
committed
fix: improve error handling in AddEmployee by logging the root cause and displaying it in the error dialog
1 parent 7a71d0b commit 6e89179

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/main/java/ui/AddEmployee.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,11 @@ private void JButtonAddEmployeeActionPerformed(java.awt.event.ActionEvent evt) {
463463
JOptionPane.showMessageDialog(this, "Employee created successfully", "Success", JOptionPane.INFORMATION_MESSAGE);
464464
});
465465
}).exceptionally(throwable -> {
466-
log.error(throwable.getMessage(), throwable);
466+
log.error(throwable.getCause().getMessage(), throwable);
467467
JButtonAddEmployee.setEnabled(true);
468468
setProgressBarVisible(false);
469469
Util.UI.setInteractionEnabled(jPanel3.getComponents(), true, () -> JButtonAddEmployee.setEnabled(true));
470-
JOptionPane.showMessageDialog(this, throwable.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
470+
JOptionPane.showMessageDialog(this, throwable.getCause().getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
471471
return null;
472472
});
473473
}//GEN-LAST:event_JButtonAddEmployeeActionPerformed

0 commit comments

Comments
 (0)