BaseXException
Thursday, 9 December 2010 · 2 messages · last reply 10 Dec 2010
MS
Michael Seiferle9 Dec 2010 22:26 #
Hi Mark,
looks nice :-)
I guess others *might* be interested in your changes too, maybe you want to share your diff?
Kind regards
Michael
Quoted text · 54 lines
Am 09.12.2010 um 21:33 schrieb Mark Boon: > OK, now it prints something like this: > > declare function local:get ( $arg as xs:string ) as xs:string > { > let $result := collection()/BOT-L/memory/variable[@name=$arg]/@value > return ( if ($result then $result/string() else > fn:concat('"',fn:concat($arg,' not found"')) ) > ^ > ^ > ^ > > [XPST0003] Expecting ")", found "t". > > }; > declare updating function local:set ( $name as xs:string, $value as xs:string ) > { > if (collection()/BOT-L/memory/variable[@name=$name]) then > replace value of node > collection()/BOT-L/memory/variable[@name=$name]/@value with $value > else > insert node element variable { attribute name {$name} , attribute > value {$value} } into collection()/BOT-L/memory > }; > let $botName := xs:string(local:get("_botName_")) > let $lastEventTime := > xs:dateTime((collection()/BOT-L/event[@from=$botName]/@dateTime)[1]) > let $now := fn:current-dateTime() > let $duration := $now - $lastEventTime > return ($duration > xs:dayTimeDuration('PT60S')) > > org.basex.core.BaseXException: Stopped at line 4, column 34: > [XPST0003] Expecting ")", found "t". > at org.basex.core.Command.execute(Command.java:66) > at org.basex.core.Command.execute(Command.java:78) > at com.avatar_reality.ai.XQuery.execute(XQuery.java:21) > at com.avatar_reality.ai.BotCommandProcessor.executeCommands(BotCommandProcessor.java:432) > at com.avatar_reality.ai.BotCommandProcessor.processEventTriggers(BotCommandProcessor.java:370) > at com.avatar_reality.ai.BotCommandProcessor.processEvent(BotCommandProcessor.java:339) > at com.avatar_reality.ai.BotCommandProcessor.processEvent(BotCommandProcessor.java:310) > at com.avatar_reality.ai.BotCommandProcessor.receiveTimerEvent(BotCommandProcessor.java:553) > at com.avatar_reality.blue_mars.iam.framework.behavior.BotLBehavior.update(BotLBehavior.java:67) > at com.avatar_reality.blue_mars.iam.framework.IamBot.update(IamBot.java:391) > at com.avatar_reality.blue_mars.iam.framework.BotProxy.update(BotProxy.java:129) > at com.avatar_reality.blue_mars.tkclient.TKClientAdapter$BotUpdater.run(TKClientAdapter.java:1283) > at java.lang.Thread.run(Thread.java:680) > > MUCH better. :) > > Mark > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
MB
Mark Boon10 Dec 2010 00:15 #
There's no diff, I just created the two wrapper classes attached below. I generated the delegation methods automatically to add all the ones I didn't 'override'. That would not have been necessary had I been able to create a sub-class. And of course it will break as soon as any methods are added or removed to the original classes. It might also break if the message-format of the error changes. Those things are out of my control.
Be aware though this was put together rather quickly, so feel free to improve if it has any caveats or problems.
Enjoy!
Mark
Quoted text · Michael Seiferle · 66 lines
On Thu, Dec 9, 2010 at 11:26 AM, Michael Seiferle <michael.seiferle at uni-konstanz.de> wrote: > Hi Mark, > > looks nice :-) > I guess others *might* be interested in your changes too, maybe you want to share your diff? > > Kind regards > Michael > Am 09.12.2010 um 21:33 schrieb Mark Boon: > >> OK, now it prints something like this: >> >> declare function local:get ( $arg as xs:string ) as xs:string >> { >> let $result := collection()/BOT-L/memory/variable[@name=$arg]/@value >> return ( if ($result then $result/string() else >> fn:concat('"',fn:concat($arg,' not found"')) ) >> ^ >> ^ >> ^ >> >> [XPST0003] Expecting ")", found "t". >> >> }; >> declare updating function local:set ( $name as xs:string, $value as xs:string ) >> { >> if (collection()/BOT-L/memory/variable[@name=$name]) then >> replace value of node >> collection()/BOT-L/memory/variable[@name=$name]/@value with $value >> else >> insert node element variable { attribute name {$name} , attribute >> value {$value} } into collection()/BOT-L/memory >> }; >> let $botName := xs:string(local:get("_botName_")) >> let $lastEventTime := >> xs:dateTime((collection()/BOT-L/event[@from=$botName]/@dateTime)[1]) >> let $now := fn:current-dateTime() >> let $duration := $now - $lastEventTime >> return ($duration > xs:dayTimeDuration('PT60S')) >> >> org.basex.core.BaseXException: Stopped at line 4, column 34: >> [XPST0003] Expecting ")", found "t". >> at org.basex.core.Command.execute(Command.java:66) >> at org.basex.core.Command.execute(Command.java:78) >> at com.avatar_reality.ai.XQuery.execute(XQuery.java:21) >> at com.avatar_reality.ai.BotCommandProcessor.executeCommands(BotCommandProcessor.java:432) >> at com.avatar_reality.ai.BotCommandProcessor.processEventTriggers(BotCommandProcessor.java:370) >> at com.avatar_reality.ai.BotCommandProcessor.processEvent(BotCommandProcessor.java:339) >> at com.avatar_reality.ai.BotCommandProcessor.processEvent(BotCommandProcessor.java:310) >> at com.avatar_reality.ai.BotCommandProcessor.receiveTimerEvent(BotCommandProcessor.java:553) >> at com.avatar_reality.blue_mars.iam.framework.behavior.BotLBehavior.update(BotLBehavior.java:67) >> at com.avatar_reality.blue_mars.iam.framework.IamBot.update(IamBot.java:391) >> at com.avatar_reality.blue_mars.iam.framework.BotProxy.update(BotProxy.java:129) >> at com.avatar_reality.blue_mars.tkclient.TKClientAdapter$BotUpdater.run(TKClientAdapter.java:1283) >> at java.lang.Thread.run(Thread.java:680) >> >> MUCH better. :) >> >> Mark >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
Written for BaseX 6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery