Add exception handling to the demo