Created
January 26, 2009 05:33
-
-
Save Kaali/52718 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Django | |
# | |
# Calling MyModel.create() raises CustomError even if the caller catches it | |
# Built-in exceptions works fine, which can be tested easily with: | |
# CustomError = Exception | |
from django.db import models | |
class CustomError(Exception): | |
pass | |
class MyModel(models.Model): | |
name = models.CharField(max_length=255) | |
@staticmethod | |
def create(): | |
raise CustomError | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment