Index: src/messages.js |
diff --git a/src/messages.js b/src/messages.js |
index d65425525dd0c16e3f3ebf4352a14ff4dfd4e7ea..4a89647577b05b205b62ebc30f65d365d271f1c2 100644 |
--- a/src/messages.js |
+++ b/src/messages.js |
@@ -1033,19 +1033,16 @@ function errorToStringDetectCycle() { |
} |
function errorToString() { |
- // These helper functions are needed because access to properties on |
+ // This helper function is needed because access to properties on |
// the builtins object do not work inside of a catch clause. |
function isCyclicErrorMarker(o) { return o === cyclic_error_marker; } |
- function isVisitedErrorsEmpty() { return visited_errors.length === 0; } |
try { |
return %_CallFunction(this, errorToStringDetectCycle); |
} catch(e) { |
- // Propagate cyclic_error_marker exception until all error |
- // formatting is finished and then return the empty string. Safari |
- // and Firefox also returns the empty string when converting a |
- // cyclic error to a string. |
- if (isCyclicErrorMarker(e) && isVisitedErrorsEmpty()) return ''; |
+ // If this error message was encountered already return the empty |
+ // string for it instead of recursively formatting it. |
+ if (isCyclicErrorMarker(e)) return ''; |
else throw e; |
} |
} |