R
Richard Cornford
Peter Michaux wrote:
Did you try (if they actually exist) versions in other languages? One of
the problems with try-catch in javascript is that the specification
leaves a great deal of leeway in the definition of the Error objects.
They already vary considerably in the messages they use between browsers
and if they also vary in language that is even worse.
Richard.
<snip>// NN6.2 can't make POST requests because can't have
arguments to send()
// so now catch NN6.2 and any other browsers that can't
take
argument to XHR.send()
function cannotPost() {
var xhr = new XMLHttpRequest();
try {
xhr.send("asdf");
} catch (e) {
// All calls to xhr.send() should error because there
wasn't a call to xhr.open()
// however the normal error is something about "not
initialized" as expected
// since xhr.open() was not called. NN6.2 gives a different
error indicating
// xhr.send() cannot take arguments.
if (-1 !== e.toString().indexOf("Could not convert JavaScript
argument arg 0 [nsIXMLHttpRequest.send]")) {
Did you try (if they actually exist) versions in other languages? One of
the problems with try-catch in javascript is that the specification
leaves a great deal of leeway in the definition of the Error objects.
They already vary considerably in the messages they use between browsers
and if they also vary in language that is even worse.
Richard.