JSON-response exception handling for Flask