Skip to content

Commit

Permalink
Merge pull request #2886 from dimagi/improve-logging-when-saving-form
Browse files Browse the repository at this point in the history
Include original exception in wrapper InvalidStateException
  • Loading branch information
avazirna authored Oct 25, 2024
2 parents 729b058 + 992eed9 commit 480c6ba
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,18 +430,18 @@ private FormRecord updateAndWriteRecord()
this, CommCareApplication.instance().getUserStorage(FormRecord.class));
} catch (InvalidStructureException e1) {
e1.printStackTrace();
throw new InvalidStateException("Invalid data structure found while parsing form. There's something wrong with the application structure, please contact your supervisor.");
throw new InvalidStateException("Invalid data structure found while parsing form. There's something wrong with the application structure, please contact your supervisor", e1);
} catch (XmlPullParserException | IOException e) {
e.printStackTrace();
throw new InvalidStateException("There was a problem with the local storage and the form could not be read.");
throw new InvalidStateException("There was a problem with the local storage and the form could not be read.", e);
} catch (UnfullfilledRequirementsException e) {
throw new RuntimeException(e);
}
}

private static class InvalidStateException extends Exception {
public InvalidStateException(String message) {
super(message);
public InvalidStateException(String message, Throwable e) {
super(message, e);
}
}

Expand Down

0 comments on commit 480c6ba

Please sign in to comment.