Its called exception handling and it isn't just for server-side code. Also, all browsers can record and/or display JavaScript errors in some fashion. Look for the settings in the browser you using.
Tools like
Firebug[
^] can also be very helpful. If you are doing any serious web development you should know about this.