Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the
.message
field on exceptions non-empty
This allows subclasses of SanicException to access their message via the `message` attribute. This makes it consistent with the `status_code`, `quiet`, `headers` attributes that were previously present on the class. Currently, the message attribute is present on the class but not on the instance, so accessing SanicException().message will return an empty string "" instead of the actual message "Internal Server Error", which you can get by calling the __str__() method or str(). This is a bit surprising, since the .message attribute shows up in autocomplete and type-checking. It also happens for the other exceptions, like str(BadRequest()) == "" as well. I set the message attribute on instances of SanicException and added tests for this new behavior.
- Loading branch information