Skip to content
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.

Exception message verbosity for <model>.DoesNotExist exception #116

Open
maennel opened this issue Apr 7, 2016 · 0 comments
Open

Exception message verbosity for <model>.DoesNotExist exception #116

maennel opened this issue Apr 7, 2016 · 0 comments

Comments

@maennel
Copy link
Contributor

maennel commented Apr 7, 2016

Exception message verbosity for related (and failed) lookups could be enhanced by adding the source object's type, identity and, if set, the querytime used for the lookup.
Note that the DoesNotExist class is bound to the related model's class.
So, the following code would raise an Article.DoesNotExist exception if no article is found:

class Journal(Versionable):
   name = CharField(...)

class Article(Versionable):
   name = CharField(...)
   journal = VersionedForeignKey(Journal)

# ...some code happens here...

# Assume there's no current journal assigned to article, this would raise a Journal.DoesNotExist exception saying: "DoesNotExist: Journal matching query does not exist."
journal = article.journal
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant