[FORMDB-4] Improve error handling in Form2dbProcessor class Created: 05/Nov/14  Updated: 18/Dec/14  Resolved: 18/Dec/14

Status: Resolved
Project: Form2DB App
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Edgar Vonk Assignee: Marvin Kerkhoff
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

I think the error handling should be improved. At least for this code excerpt from the latest Form2dbProcessor class:

catch (Exception e) {

}

Normally you should not catch the generic Exception class but more specific ones. And at the very least the exception should be logged here because now when something goes wrong I have no idea what or why.

log.error("Some informative message here", e);


 Comments   
Comment by Edgar Vonk [ 05/Nov/14 ]

Another thing in this class. When something goes wrong the JCR session is not saved so nothing is stored. I don't think this would be the intention? I think you need to add a finally clause and save the session there. E.g.:

try {
[..]
} finally {
 if (null != existingPage) {
    existingPage.getSession().save();
 }
}
Comment by Marvin Kerkhoff [ 18/Dec/14 ]

Thanks for the patch. I guess it will help to make the processor more stable.

Generated at Mon Feb 12 01:58:14 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.