Skip to content

Instantly share code, notes, and snippets.

@Kaali
Created January 26, 2009 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kaali/52718 to your computer and use it in GitHub Desktop.
Save Kaali/52718 to your computer and use it in GitHub Desktop.
# 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