Expose browser errors uniformly outside of GlobalErrors

This commit is contained in:
Steve Gravrock
2025-10-04 12:11:14 -07:00
parent dbcc1c924a
commit bca56032e0
7 changed files with 135 additions and 195 deletions

View File

@@ -77,8 +77,8 @@ getJasmineRequireObj().QueueRunner = function(j$) {
}
QueueRunner.prototype.execute = function() {
this.handleFinalError = (error, event) => {
this.onException(errorOrMsgForGlobalError(error, event));
this.handleFinalError = error => {
this.onException(error);
};
this.globalErrors.pushListener(this.handleFinalError);
this.run(0);
@@ -108,8 +108,8 @@ getJasmineRequireObj().QueueRunner = function(j$) {
this.recordError_(iterativeIndex);
};
function handleError(error, event) {
onException(errorOrMsgForGlobalError(error, event));
function handleError(error) {
onException(error);
}
const cleanup = once(() => {
if (timeoutId !== void 0) {
@@ -296,16 +296,5 @@ getJasmineRequireObj().QueueRunner = function(j$) {
};
}
function errorOrMsgForGlobalError(error, event) {
// TODO: In cases where error is a string or undefined, the error message
// that gets sent to reporters will be `${message} thrown`, which could
// be improved to not say "thrown" when the cause wasn't necessarily
// an exception or to provide hints about throwing Errors rather than
// strings.
return (
error || (event && event.message) || 'Global error event with no message'
);
}
return QueueRunner;
};