3 ms·
Setting aside the fact that your question is loaded ("littered" with incorrect error handling--OK): 1. Return something meaningful, not the bare error you rece
by dullgiulio 9y ago
Setting aside the fact that your question is loaded ("littered" with incorrect error handling--OK):
1. Return something meaningful, not the bare error you received above.
2. If you do nothing but decorate the error, ignore coverage. Having decorated the error helps debug the full system when the error occurs.
3. If your error handling is more complex (remove temporary files, close handler, etc.), you might want to factor the cleanup into its own function and test it there.
Finally, your code is not really "littered." If you had exceptions, there would be no trace of the possible errors that might occur on the production system. Your coverage will be higher, but when the software will blow up in production, it will not matter then least.