Exception occurring not inside controllers/services, not reported

I noticed that exceptions occurring not inside controllers/services but in plain javascript code is not being reported, doesn’t appear in the console and can’t be handled. For example, if I have Car class, which is being invoked from controller or service and there is exception inside the Car class, ionic will not report this error and swallow it.

Function Car {

this.drive = function() {
	// exception occurs here
}

}

Any idea on how to catch those exceptions?