During doing some work in java a question came into in my mind that Are both same ? or are they different? So i decided to take yours input. In my thinking anything which can be handled or can be imagined before it occurs in java we call it exception otherwise its an error? Am i Right?
i believe you are essentially correct - despite of my limited grasp on the subject. "exceptions" refers to errors (runtime) that can be trapped and controlled. as opposed to "errors" that are just bad syntax and break the compiler fully... for instance, this is an exception which is being handled: try { colours[2] = "red"; } catch (e) { alert("Oops!"); // assignment failed because colours is not in the global namespace as an array } PHP: whereas this: alert("the quick brown fox jumps over the lazy dog); PHP: is a syntax error (missing "). another thing you can is you can figure and log the exceptions - do a console.log(e) to see the properties, i believe something like e.message, e.name etc. you can also check against error types like: if (e instanceof TypeError) ... or just ignore exceptions and do nothing at all.
i just remembered I had planned to post my exceptions handler and reporting tool (via ajax) on my blog for a while, thanks it's public now... if interested in the idea of knowing about your visitors' javascript exceptions, click here: http://fragged.org/obscure-javascri...-and-reporting-via-ajax-for-mootools_512.html