Обсуждение: SQLException subclasses

Поиск
Список
Период
Сортировка

SQLException subclasses

От
TimothyReaves@westfieldgrp.com
Дата:
     Has any thought been given to subclassing SQLException to better
control what happens when an exception occurs?  There is a difference
between how I would like to handle different things.  Particularly pk
exceptions.  I'm sure I could parse the text of the exception, but would a
DuplicatePrimaryKeyException be better than the generic SQLException?


Re: SQLException subclasses

От
"Joe Shevland"
Дата:
There is work in progress (I think) to have the backend generate integer
error codes based on different occurences; once this occurs the error
numbers are going to be propogated through to the front-end (JDBC driver)
where we will be able to say SQLException.getErrorCode() and perform
different actions for different problems.

ATM, though, I think you're stuck with parsing the messages you get back
:( I have done this for an internal app in a few cases, and it works, but
it very likely to break at some stage (l10n of error messages etc).

Regards,
Joe

>      Has any thought been given to subclassing SQLException to better
> control what happens when an exception occurs?  There is a difference
> between how I would like to handle different things.  Particularly pk
> exceptions.  I'm sure I could parse the text of the exception, but would
a
> DuplicatePrimaryKeyException be better than the generic SQLException?

Вложения