def get_http_error(exception): """ Returns proper http failure status code according to the provided exception. """ if 'Not a git repository' in exception.args[0]: return HttpResponseNotFound()