Serhiy Storchaka added the comment:

I think ProgrammingError is not correct type of an exception. It is used for 
programming errors such as using uninitialized or closed objects or supplying 
incorrect number of bindings. But this error can be caused by invalid data in a 
database created not by Python. Currently converters raise ValueError or 
TypeError for invalid data. ValueError is raised for datetime without 
microseconds but with timezone offset. I think ValueError is more appropriate 
type for such errors.

Perhaps even TypeError should be converted to ValueError.

    try:
        # parsing date or datetime
    except (ValueError, TypeError):
        raise ValueError(...)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29099>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to