Better error handling for example