Rats, I just found out that the XQuery class is defined as final. :-((
On Thu, Dec 9, 2010 at 8:40 AM, Mark Boon <mboon(a)avatar-reality.com> wrote:
> Well, as I said, it was just an off-the-wall idea. And I appreciate
> the focus on performance, it's paramount.
>
> Having said that, the XQuery class is the one that has the query and
> generates the exception and is thereby in the unique position to
> easily perform certain services, like providing a nicely formatted
> error to the exception. Any other solution is going to be a workaround
> at best. The best I can think of right now is to sub-class XQuery and
> catch the BaseXException and wrap it in a new exception in the
> execute() method and add a printErrorDetail() method that does the
> formatting as I explained. I see little drawback in terms of either
> performance or security, as you'll still be free to use the base-class
> in any case.
>
> So that's what I'll do. Maybe I'm the only one who sees the value of
> it, I thought there would be more developers who'd benefit of such an
> implementation.
>
> Mark
>
>
> On Thu, Dec 9, 2010 at 1:08 AM, Christian Grün
> <christian.gruen(a)gmail.com> wrote:
>>> org.basex.core.BaseXException: Stopped at line 42, column 55:
>>> [XPST0003] Expecting ")", found """.
>>>
>>> However, it doesn't show me the query. Since I generate (sometimes
>>> large) queries automatically, this message by itself is not always
>>> very helpful (to put it very mildly).
>>
>> In your case, I'd recommend to wrap query execution with try/catch and
>> lookup the relevant snippet by yourself; this is similar to what Jan
>> has already proposed. If this should not be possible for reason, feel
>> free to comment back on this.
>>
>> Based on my experiences, a more detailed error feedback would
>> represent undesirable overhead.
>>
>> Christian
>>
>