updated error handling example