Added ResourceNotFoundException handling.

* Improved error exception handling.
Minor changes.