Skip to content

Commit

Permalink
Improved error dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
nwaldispuehl committed Aug 17, 2016
1 parent 824f751 commit 0040327
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public IntervalMusicCompositorUI(final MusicListControl musicListControl,

private void installUncaughtExceptionHandler() {
Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> {
messageProducer.send(new ErrorMessage(throwable.getMessage()));
messageProducer.send(new ErrorMessage(throwable));
messageProducer.send(new DebugMessage(IntervalMusicCompositorUI.this, throwable));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ private void showErrorMessage(String message) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setResizable(true);
alert.setTitle(bundle.getString("ui.error.title"));
alert.setContentText(message);
alert.setContentText(message + "\n\n" + bundle.getString("ui.error.appendix"));
alert.getDialogPane().getChildren().stream().filter(node -> node instanceof Label).forEach(node -> ((Label)node).setMinHeight(Region.USE_PREF_SIZE));
alert.show();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ui.instructions = Ziehe Musikdateien (der unterstützten Formate MP3, OGG, FLAC,

# Error stuff
ui.error.title = Interval Music Compositor - Fehler
ui.error.appendix = (Siehe unter "Hilfe" -> "Ereignisanzeige" für Details.)

# About box
ui.about.title = Über
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ui.instructions = Drag and drop music files (supported formats: MP3, OGG, FLAC,

# Error stuff
ui.error.title = IntervalMusicCompositor - Error
ui.error.appendix = (See "Help" -> "Debug log" for more information.)

# About box
ui.about.title = About
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,18 @@ public ErrorMessage(String message) {
super(message);
}

public ErrorMessage(Throwable throwable) {
super(getMessageFrom(throwable));
}

private static String getMessageFrom(Throwable throwable) {
String message = throwable.getMessage();
if (message != null) {
return message;
}
else {
return throwable.getClass().getSimpleName();
}
}

}

0 comments on commit 0040327

Please sign in to comment.