Re: Binary Module error codes

On 5 August 2013 09:39, John Lumley wrote:

  Hi John,

> I was under the impression that some similarity with XPath
> error code formats was suggested, which uses a 4 character/ 4
> number system.  In EXPath, the file: and the sql: modules uses
> that (though sql: isn't entirely consistent), albeit not
> encoding program/phase in the 4 characters.  crypto: and
> http-client: use short codes.

  Thanks for pointing out the inconsistencies!

  Actually, I thought again about error codes over the weekend,
and I am not sure that using one different namespace for errors,
one global to all EXPath modules, is the best way.  It was indeed
kind of mimicking XPath error codes.  But there is no reason to
use another namespace than the module namespace, and certainly
not to put all of the error codes in the same namespace.

  I think it would be cleaner actually to have the error codes in
the module namespace.  For instance we could have bin:ERR001.
In XQuery 3.0, a try/catch would look like:

    try {
       ...
    }
    catch http:ERR006 {
       ...
    }
    catch bin:ERR005 {
       ...
    }

which makes more sense I think than the following:

    try {
       ...
    }
    catch err:HC006 {
       ...
    }
    catch err:BIN005 {
       ...
    }

  I think it is still time to change the error handling, and we
should define it once and for all (in order to not have that
discussion again for new modules :-p).

  What do you (all) think?  Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/

Received on Monday, 5 August 2013 10:22:45 UTC