I have a JavaScript script that is using the jquery post
command to log into a server and obtain a token. I've wrapped my code in a try
block with a catch
block that looks like this:
catch (error)
{
alert(error.message);
}
My code runs fine, but to test it thoroughly, I intentionally changed the protocol so that the url looks like this:
"htt://some.domain:8080/jsonrpc"
My code does not catch the error and display the alert. Rather, the Chrome console shows the following error:
XMLHttpRequest cannot load htt://some.domain:8080/jsonrpc. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
I would expect some kind of malformed url exception instead of the error in the console.
The results of other intentional errors such as incorrect password result in exceptions that are caught.
Thanks