Skip to content

Commit

Permalink
Adjust save exception to inlcude orgininal stack traces
Browse files Browse the repository at this point in the history
  • Loading branch information
Siedlerchr committed Apr 20, 2019
1 parent 1c11575 commit e63bc21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private boolean saveDatabase(Path file, boolean selectedOnly, Charset encoding,
} catch (UnsupportedCharsetException ex) {
throw new SaveException(Localization.lang("Character encoding '%0' is not supported.", encoding.displayName()), ex);
} catch (IOException ex) {
throw new SaveException(ex);
throw new SaveException("Problems saving:", ex);
}

return true;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/jabref/logic/exporter/SaveException.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class SaveException extends Exception {
public static final SaveException BACKUP_CREATION = new SaveException("Unable to create backup",
Localization.lang("Unable to create backup"));

private final BibEntry entry;
private BibEntry entry;
private int status;
private String localizedMessage;

Expand Down Expand Up @@ -46,18 +46,18 @@ public SaveException(String message, BibEntry entry) {
this.entry = entry;
}

public SaveException(String message, String localizedMessage, BibEntry entry) {
super(message);
public SaveException(String message, String localizedMessage, BibEntry entry, Throwable base) {
super(message, base);
this.localizedMessage = localizedMessage;
this.entry = entry;
}

public SaveException(Throwable base) {
this(base.getMessage(), base.getLocalizedMessage());
super(base.getMessage(), base);
}

public SaveException(Throwable base, BibEntry entry) {
this(base.getMessage(), base.getLocalizedMessage(), entry);
this(base.getMessage(), base.getLocalizedMessage(), entry, base);
}

public int getStatus() {
Expand Down

0 comments on commit e63bc21

Please sign in to comment.