-
-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the error message informing the value that it got it (#536)
* Improve error message of iscallable validator * Add stubs for NotCallableError * Add changelog for iscallable validator
- Loading branch information
1 parent
98185bf
commit 68af33e
Showing
6 changed files
with
78 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
``attr.validators.is_callable()`` validator now raises an exception ``attr.exceptions.NotCallableError``, a subclass of ``TypeError``, informing the received value. | ||
`#536 <https://github.com/python-attrs/attrs/pull/536>`_. |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
from typing import Any | ||
|
||
class FrozenInstanceError(AttributeError): | ||
msg: str = ... | ||
|
||
class AttrsAttributeNotFoundError(ValueError): ... | ||
class NotAnAttrsClassError(ValueError): ... | ||
class DefaultAlreadySetError(RuntimeError): ... | ||
class UnannotatedAttributeError(RuntimeError): ... | ||
|
||
class NotCallableError(TypeError): | ||
msg: str = ... | ||
value: Any = ... | ||
def __init__(self, msg: str, value: Any) -> None: ... |
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
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