DJango除了会抛出Python的标准异常外还有一些框架自带的异常。
- Django核心异常
在django.core.exceptions中:
ObjectDoesNotExist | FieldDoesNotExist |
MultipleObjectsReturned | SuspiciousOperation |
PermissionDenied | ViewDoesNotExist |
MiddlewareNotUsed | ImproperlyConfigured |
FieldError | ValidationError |
- URL解析器异常
在django.core.urlresolvers中:
Resolver404 | NoReverseMatch |
- 数据库异常
在django.db中:
Error | InterfaceError |
DatabaseError | DataError |
OperationalError | Int |