On 28-6-2014 11:29, Dmitry Yemanov wrote:
> Usually, the status vector has one error or a number of dependent errors
> (first one is primary and others are qualifying the primary one).
> Sometimes it contains errors that may look independent, but in fact
> they're dependent (one error may cause another one before being
> processed), however it could be hard to figure out.
>
>> A separate problem is identifying the most specific error. I notice that
>> the head of the status vector has the least specific error code (eg
>> isc_dsql_error instead of isc_dsql_field_err for a "Column unknown") is
>> there an algorithm to determine the most specific error code or do I
>> need to apply some heuristic (eg if the errorcode is isc_dsql_error then
>> use the next error code, or always use the last one).
>
> I'm afraid only heuristics may help.

I have rewritten the way I convert the status vector to a SQLException 
by 'flattening' the exception and looking for a more specific error 
code. When looking for the more specific error code I apply the 
following heuristic:

When an error code is one of the 'uninteresting' error codes or the 
error code is mapped to SQLstate 00000 I try the next error code.
If I didn't find a more interesting error code I fallback to the first 
error code.

Uninteresting error codes are (for now, I might add some more later):
{ 0, isc_dsql_error, isc_dsql_line_col_error, isc_dsql_unknown_pos, 
isc_sqlerr, isc_dsql_command_err }

For debugging purposes I include the original error codes (and 
individual messages) as an exception cause.

See http://sourceforge.net/p/firebird/code/59791/#diff-6

Mark
-- 
Mark Rotteveel

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to