Please note that the error mechanism is based on a server that is using the charts data source library and returning a valid JSON response (error or not). If there is a communication error the JavaScript callback is not called. However, Query does have a timeout for each request and after 30 seconds you will see an error "request timed out".
HTH On Sunday, July 11, 2010 5:11:28 PM UTC+3, h wrote: > > Trying looking at the network console and see what is the response coming > back from your server, maybe its malformed. > > ChartMan > > On Sun, Jul 11, 2010 at 3:22 AM, lesfreeman <[email protected]>wrote: > >> I've tried that method as well: >> >> var query = new google.visualization.Query("http://some-server.com/ >> api"); >> console.log("about to send query"); >> query.send(function(response){ >> console.log("in response function"); >> if (response.isError()) { >> alert(response.getMessage()); >> return; >> } >> var data = response.getDataTable(); >> ... >> }); >> >> The "about to send query" message is logged to the console but the "in >> response function is not. Instead, I still get the Uncaught Error >> message: >> >> about to send query >> Uncaught Error: google.visualization.Query: Internal Server Error >> [500] - >> >> default,browserchart,columnchart,barchart,piechart,table,gauge,annotatedtimeline >> +en_US.I.js:151 >> >> Same thing if I move the console.log to after the if statement: >> >> query.send(function(response){ >> if (response.isError()) { >> alert(response.getMessage()); >> return; >> } >> console.log("in response function"); >> var data = response.getDataTable(); >> ... >> }); >> >> Really appreciate your time and your help! >> Les >> >> >> On Jun 27, 6:33 am, Jinji <[email protected]> wrote: >> > The query.send() function doesn't throw exceptions. Instead, in your >> > response function (the one you pass to query.send), you should do: >> > >> > if (response.isError()) { >> > alert(response.getMessage()); >> > return;} >> > >> > dataTable = response.getDataTable(); >> > >> > I hope that helps. >> > >> > On Thu, Jun 24, 2010 at 7:13 AM, lesfreeman <[email protected] >> >wrote: >> > >> > >> > >> > > Hello, >> > > I'm trying to catch server errors and display a custom error message. >> > > Unfortunetly, I can't seem to catch the error on the JS side. Here's >> > > the short version of my code: >> > >> > > try{ >> > > var query = new google.visualization.Query("http://some-server.com/ >> > > api"); >> > > query.send(function(response){ >> > > //some stuff gets done here >> > > }); >> > > }catch(e){ >> > > console.log(e.name+" "+e.message); >> > > } >> > >> > > Unfortunately, the error does not get caught. I my JS console I get: >> > >> > > Uncaught Error: google.visualization.Query: Internal Server Error >> > > [500] >> > >> > > If I throw a custom error in the try block, it gets caught. >> > >> > > Any ideas? >> > >> > > Thanks >> > > Les >> > >> > > -- >> > > You received this message because you are subscribed to the Google >> Groups >> > > "Google Visualization API" group. >> > > To post to this group, send email to >> > > [email protected]. >> > > To unsubscribe from this group, send email to >> > > [email protected]<google-visualization- >> > > >> api%[email protected]> >> > > . >> > > For more options, visit this group at >> > >http://groups.google.com/group/google-visualization-api?hl=en. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Visualization API" group. >> To post to this group, send email to >> [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-visualization-api?hl=en. >> >> > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/FxlT0P4tsY4J. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
