Hi !
The changelog on the YQL blog
YQL Changelog build 3396 says the following about timeout functions for y.rest and y.query:
New feature highlights:
* y.rest and y.query now support timeouts
o y.rest(..).timeout(30).get() will fail after 30ms
o y.query(…,30) will fail after 30ms
o An exception gets thrown if the timeout is hit
I was not able to catch this exception with code like this :
CODE
<execute><![CDATA[
try {
var response=y.rest('http://www.yahoo.com').timeout(1).get().response;
}
catch (e){
y.log(e);
}
]]>
</execute>
I get the following result on the YQL console:
CODE
<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
yahoo:count="0" yahoo:created="2010-09-02T01:18:32Z" yahoo:lang="en-US">
<diagnostics>
.....
<warning>Results may be truncated because the run exceeded the allowed max response timeout of 1ms.</warning>
<javascript execution-time="4" instructions-used="2000" table-name="mytable"/>
<javascript name="mytable" verb="select"><![CDATA[Results may be truncated because the run exceeded the allowed max response timeout of 1ms.]]></javascript>
<user-time>350</user-time>
<service-time>341</service-time>
<build-version>8771</build-version>
</diagnostics>
<results/>
</query>
This makes the timeout function quite useless since it only makes it possible to stop the whole execution but no way to handle the error gracefully.
Am I wrong ?
Loic