You could also use try / finally and and restore the request_path in finally block. This way you only need to do it once and don't need to re-raise exception.