2010-02-08 15:00:28 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
|
|
|
|
2010-02-08 16:07:32 +00:00
|
|
|
from shortcuts import HttpErrorJson, render_to_json_response
|
2010-02-08 15:00:28 +00:00
|
|
|
|
|
|
|
class ExceptionMiddleware(object):
|
|
|
|
|
2010-02-08 15:30:16 +00:00
|
|
|
def process_exception(self, request, exception):
|
2010-02-08 16:07:32 +00:00
|
|
|
if isinstance(exception, HttpErrorJson):
|
2010-02-08 15:30:16 +00:00
|
|
|
return render_to_json_response(exception.response)
|
|
|
|
else:
|
|
|
|
return None
|
2010-02-08 15:00:28 +00:00
|
|
|
|