On Mon, Apr 22, 2019 at 10:44:59AM -0400, [email protected] wrote:
> Revision 980 Author cito Date 2019-04-22 10:44:58 -0400 (Mon, 22 Apr 2019)
+.. method:: Query.single()
+
+ Get single row from the result of a query as a tuple
+
+ :returns: single row from the query results as a tuple of fields
+ :rtype: tuple
+ :raises ProgrammingError: result does not have exactly one row
Isn't it a best-practice to make a subclass of ProgrammingError just for that ?
Else it encourages people to write "except ProgrammingError:" without also
checking "if 'exactly one row' in e".
...and anyone who raises ProgrammingError (perhaps while subclassing pg.DB) is
at risk of accidentally including the magic string in their exception:
|raise db.ProgrammingError('"is not exactly one row" is not exactly one row') #
oh no
Justin
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo/pygresql