Fine-grained error handling using doTry…doCatch