i’m tryin to identify the error i get in a javascrip function in my webpage, so i added
function guardarMisDatos() throws Exception {
try{
...
} catch (Exception e){
alert("error: ", e);
}
but when i open the page, the chrome web console gives me error at
function guardarMisDatos() throws Exception {
and the error type is “Uncaught syntaxerror: unexpected identifier”
where is the error? is it a correct way to check way the function is not fired on the first click?
Remove “throws Exception” and the catch reference to “Exception”. To know what kind of exception it is, look at the e.name property, it’ll be one of six things:
These aren’t constants, they’re the actual string, as in
if (e.name.toString()=="TypeError")There are a lot of other good things on the error object too, read more at http://www.javascriptkit.com/javatutors/trycatch2.shtml