Build the query string for the exception and return a redirect to the
        redirect uri that was associated with the request.

def redirect_exception(self, exception):
        """
        Build the query string for the exception and return a redirect to the
        redirect uri that was associated with the request.
        """

        from django.http import QueryDict, HttpResponseRedirect

        query = QueryDict("").copy()
        query["error"] = exception.error
        query["error_description"] = exception.reason
        query["state"] = self.state

        return HttpResponseRedirect(self.redirect_uri.url + "?" + query.urlencode())