Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raise a consistent exception on input encoding errors
Currently, when invalid input is passed a query argument, asyncpg will raise whatever exception was triggered by the codec function, which can be `TypeError`, `ValueError`, `decimal.InvalidOperation` etc. Additionally, these exceptions lack sufficient context as to which argument actually triggered an error. Fix this by consistently raising the new `asyncpg.DataError` exception, which is a subclass of `asyncpg.InterfaceError` and `ValueError`, and include the position of the offending argument as well as the passed value, e.g: asyncpg.exceptions.DataError: invalid input for query argument $1: 'aaa' (a bytes-like object is required, not 'str') Fixes: #260
- Loading branch information
Showing
6 changed files
with
75 additions
and
50 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
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
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