Added code to show how to manage exceptions