LArSoft needs an error handling policy
LArSoft needs an error handling policy,see http://cd-docdb.fnal.gov/cgi-bin/ShowDocument?docid=5766
#4 Updated by Katherine Lato almost 3 years ago
- Category set to Documentation
- Status changed from Accepted to Assigned
- Assignee set to Katherine Lato
- Target version deleted (
from the document:
3.5. Error handling in LArSoft modules
Type: LArSoft coding guidelines
Issue: The definition of error conditions, and the actions taken in response (including whether to throw an exception) is completely defined by code authors.
Recommendation: LArSoft needs an error handling policy, saying how module code should respond to error conditions, what exceptions should be thrown, what should be reported to the framework, and how to configure the framework to respond appropriately. The policy should also prescribe what common conditions constitute an “error” versus a “warning”, etc. An education campaign will then be needed to disseminate this information.
After discussion with Marc Paterno:
If the caller of the module knows what to do if it doesn’t work, then returning a status code is probably enough.
If the caller of the module isn’t likely to know what to do, throw an exception by using the art::Exception class. Pick the error code that is closest. Can add more details in an error message. Whether the error is treated as fatal is up to the framework.
Still need work on:
The policy should also prescribe what common conditions constitute an “error” versus a “warning”, etc. An education campaign will then be needed to disseminate this information.
#5 Updated by Katherine Lato about 1 year ago
While we are linking to the art document on the use of assert versus exceptions, https://cdcvs.fnal.gov/redmine/projects/art/wiki/AssertsVsExceptions, and the one on art exit codes, https://cdcvs.fnal.gov/redmine/projects/art/wiki/ArtExitCodes, we would still like to link to https://cdcvs.fnal.gov/redmine/projects/art/wiki/ExceptionInformation once that is updated.
#7 Updated by Katherine Lato 25 days ago
- Status changed from Assigned to Resolved
Now that there's an art page to point to:
I updated the LArSoft page: