- Write a custom error handling JavaScript function called processErrors that handles a custom error by assigning it to the onerror event handler. Include the block of JavaScript statements needed to pass the arguments sent by the JavaScript interpreter into the processErrors function, send an alert message with the agreements, return, and write the event handler that calls the processErrors function.
Question: Does the following code include the requirments to the above question?
function processErrors(errMessage, errURL,
errLineNum) {
window.alert("The fi le " + errURL
+ " generated the following error: "
+ errMessage + " on line " + errLineNum);
return true;
}
window.onerror=processErrors;
This is the code from my text. If I understand correctly, errMessage, errURL, and errLineNum are the arguments passed by the JavaScript interpreter. Are these always the arguments that will always be passed anytime you specify a custom error-handling function by assigning it to the onerror event handler?
Does the following portion of the code complete the requirments: send an alert message with the agreements, return, and write the event handler that calls the processErrors function.
window.alert("The fi le " + errURL
+ " generated the following error: "
+ errMessage + " on line " + errLineNum);
return true;
}
window.onerror=processErrors;
Can someone please help shed some light on this or at least direct me. I somewhat understand but when I start to put it all together I feel like I am just throwing stuff out there with no real organization. Any and all help will be greatly appreciated. Thank you.