[DB-SIG] Error in DB-API 2.0
Fri, 10 May 2002 14:50:59 -0700 (PDT)
On Fri, 10 May 2002, M.-A. Lemburg wrote:
> Godefroid Chapelle wrote:
> > Hi,
> > After reading DB-API 2.0 spec, it is not clear for me which Error class
> > should be raised when trying to reuse a primary key.
> > IntegrityError seems to be the best place but DataError could also be
> > candidate.
> > Your opinion ?
> I'd suggest that this is a ProgrammingError -- the programmer
> is doing something wrong here, not the database or the user.
Most of the other errors are also due to 'user error', so I dont think
that's exactly the right paradigm to use.
I think 'IntegrityError' is the most appropriate. The data is fine, but it
violates the integrety of the database as it violates the 'uniqueness' of
the primary keys.
'DataError' would be used when the type of information you're trying to
pass is not valid. Eg, using a string for a integer column.
("`-/")_.-'"``-._ Ch'marr, a.k.a.
. . `; -._ )-;-,_`) Chris Cogdon <email@example.com>
(v_,)' _ )`-.\ ``-'
_.- _..-_/ / ((.' FC1.3: FFH3cmA+>++C++D++H++M++P++R++T+++WZ++Sm++
((,.-' ((,/ fL RLCT acl+++d++e+f+++h++i++++jp-sm++