This seems like a better place to catch exceptions, rather than inside the `make_badge_data` function. This way, if that function fails, the view function can either try again, or render the template with a message indicating that the badge data is incorrect.