Hoy a sido un día ajetreado de javasciprt, entre otras cosas me quedo con esta, que ya tenia ganas de saber que era:
The try - catch - finally statement
The try - catch - finally control stucture allows you to detect errors and quietly deal with them without producing error messages or aborting the script, and in fact, without even interrupting the flow of the script that is running. This makes it superior to the original way of handling script errors (without error messages) where scripts are completely aborted:
window.onerror = referenceToFunction;
try {
//do something that might cause an error
} catch( myError ) {
//if an error occurs, this code will be run
//two properties will (by default) be available on the
//object passed to the statement
alert( myError.name + ': ' + myError.message );
} finally {
//optional - this code will always be run before the
//control structure ends, even if you rethrow the error
//in the catch
}
Vía HowToCreate.co.uk (que por cierto a ver si le echo alguna otra ojeada)
más info en msdn

0 Comments:
Post a Comment
<< Home