Explorar o código

Make tag check stricter and use a map

John Lees-Miller %!s(int64=6) %!d(string=hai) anos
pai
achega
497f2a7936
Modificáronse 1 ficheiros con 2 adicións e 4 borrados
  1. 2 4
      libraries/o-error/index.js

+ 2 - 4
libraries/o-error/index.js

@@ -108,10 +108,8 @@ class OError extends Error {
 
 
     let stack = oError.stack
     let stack = oError.stack
 
 
-    if (oError._oErrorTags) {
-      for (const tag of oError._oErrorTags) {
-        stack += `\n${tag.stack}`
-      }
+    if (Array.isArray(oError._oErrorTags) && oError._oErrorTags.length) {
+      stack += `\n${oError._oErrorTags.map((tag) => tag.stack).join('\n')}`
     }
     }
 
 
     const causeStack = oError.cause && OError.getFullStack(oError.cause)
     const causeStack = oError.cause && OError.getFullStack(oError.cause)