On 17 March 2010 21:07, Wolfgang Meier <wol...@ex...> wrote:
>> This is just a simple example, see the attached diff, but I am
>> wondering if there is value in, expanding on this concept and pushing
>> xquery line context information into the datatype system for better
>> errors.
>
> It somehow doesn't feel right to add caller information to the
> returned data values. Our approach so far has been to catch the thrown
> exception on a higher level and add the line information there. See
> class FunctionCall for an example. I think this concept could be
> extended, though we won't be able to cover all cases where a type
> error could occur.
> But for your example, the if expression could certainly catch and
> rethrow the exception.
Okay cool :-)
I actually simplified, in my case the invoking expression was OpOr.
I agree that maybe it doesnt make sense to send in the Expression to
the Type, which is what lead me to thinking about changing the
Exception thrown by Types from XPathExpression (which I think we over
use too much) to something new like XMLDataTypeException, this should
then immediately highlight where this Exception is being thrown, we
can then write wrapper try/catch in the culprit Expressions that catch
that Exception, and throw an XPathException with the line and column
number of the Expression added in.
Hows that sound?
> Wolfgang
>
--
Adam Retter
eXist Developer
{ United Kingdom }
ad...@ex...
irc://irc.freenode.net/existdb
|