From: Adam R. <ad...@ex...> - 2011-04-28 17:42:45
|
On 28 April 2011 17:04, Andrzej Jan Taramina <an...@ch...> wrote: > Adam: > >> You should probably not pass a null value, as the designer of the 3rd >> part extension function, if you are throwing an exception then its >> really up to you to define the error code and error description; I >> would really suggest that you choose an error code that does not clash >> with any of the error codes from F&O 3.0 (unless they apply). > > I changed my code to pass in an empty sequence for the errorVal parameter instead of a null, though > I'm not sure if that will make much difference. Both ways compiled fine. > > Still would like to know what errorVal is actually used for. The use of error value is not defined in the XQuery 3.0 specs, so it puzzled me for some time also. If you look at how I have used it from other areas of eXist-db, then you will see that typically I pass in the context sequence or troublesome parameter that resulted in the error. In this way the developer can then act on this in the 'catch' expression of try/catch. If you dont have a value, then use the Sequence.EMPTY_SEQUENCE. > Thx! > > ...A > >> On 28 April 2011 03:48, Andrzej Taramina <an...@ch...> wrote: >>> Ok...but can I pass a null errorVal? And if not, what kind of values would be appropriate? >>> >>> ...Andrzej >>> >>> On 2011-04-27, at 8:57 PM, Adam Retter <ad...@ex...> wrote: >>> >>>> We modified XPathException to provide the information that is required >>>> in XQuery 3.0 to support the try/catch expressions. As such all >>>> XQuery/XPath exceptions should have a defined error value and >>>> associated message. This works well for everything that is within the >>>> spec of F&O 3.0, as they define concise constant error codes and >>>> values. But, if you are working outside of that i.e. extension >>>> functions, then you need to define your own constant error values and >>>> descriptions. See the try/catch details in the XQuery 3.0 spec.... >>>> >>>> On 27 April 2011 23:50, Andrzej Jan Taramina <an...@ch...> wrote: >>>>> ...looks like many XPathException constructor signatures are now deprecated. Bit of a pain to >>>>> create ErrorCode()s for custom errors, but so be it. >>>>> >>>>> My question is whether the ErrorVal can be set safely to null for the constructor? >>>>> >>>>> XPathException( Expression expr, ErrorCode errorCode, String errorDesc, Sequence errorVal, >>>>> Throwable cause ) >>>>> >>>>> It looks like you can provide a description both in the ErrorCode object and separately in the >>>>> erroDesc. Can someone shed some light into why this is the case, and what happens if you provide >>>>> both or the description is missing in the ErrorCode or set to the empty string? Seems a bit odd to >>>>> have both. >>>>> >>>>> What is the errorVal used for? >>>>> >>>>> Can you tell I'm trying to update some of our custom extensions/functions to 1.5/Trunk? LOL >>>>> >>>>> Thanks! >>>>> >>>>> -- >>>>> Andrzej Taramina >>>>> Chaeron Corporation: Enterprise System Solutions >>>>> http://www.chaeron.com >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> WhatsUp Gold - Download Free Network Management Software >>>>> The most intuitive, comprehensive, and cost-effective network >>>>> management toolset available today. Delivers lowest initial >>>>> acquisition cost and overall TCO of any competing solution. >>>>> http://p.sf.net/sfu/whatsupgold-sd >>>>> _______________________________________________ >>>>> Exist-development mailing list >>>>> Exi...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/exist-development >>>>> >>>> >>>> >>>> >>>> -- >>>> Adam Retter >>>> >>>> eXist Developer >>>> { United Kingdom } >>>> ad...@ex... >>>> irc://irc.freenode.net/existdb >>> >> >> >> > > > -- > Andrzej Taramina > Chaeron Corporation: Enterprise System Solutions > http://www.chaeron.com > -- Adam Retter eXist Developer { United Kingdom } ad...@ex... irc://irc.freenode.net/existdb |