filoquin / json-xml-rpc

Automatically exported from code.google.com/p/json-xml-rpc
0 stars 0 forks source link

Catch an exception when the service is down #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
An html error page will attempt to be parsed as JSON and will throw a new
SyntaxError

[Exception... "'SyntaxError: Badly formed JSON string: <!DOCTYPE HTML
PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>503 Service
Temporarily Unavailable</title> </head><body> <h1>

What steps will reproduce the problem?
1. Turn off the service that you are calling (the server will respond with
404, 503 or something else and a bit of html )

What is the expected output? What do you see instead?
I would have liked to see on of my handlers handeling the
failure/exception/error. That way I can prevent browser messages and let my
script take the actions I see fit for the situation.

What version of the product are you using? On what operating system?
Version: 0.8.0.2 (2007-12-06), I have tested on Ubuntu FF, XP IE7 and XP
IE8 clients.

Original issue reported on code.google.com by DutchCo...@gmail.com on 16 Jul 2009 at 10:17

GoogleCodeExporter commented 8 years ago
I kinda fixed the issue with the attached code that replaces
rpc.ServiceProxy.prototype.__evalJSON. 

If anybody has a better idea, I'ld love to here it.

Original comment by DutchCo...@gmail.com on 16 Jul 2009 at 12:29

Attachments: