def post_excp(req, resp, error): if type(error) == CustomException: resp.body = json.dumps({ 'error': 'hahah' }) resp.status = falcon.HTTP_500 # raise error