Browse Source

Update CallStack.hx (#9947)

Nicolas Cannasse 4 years ago
parent
commit
efb8c05a63
1 changed files with 4 additions and 3 deletions
  1. 4 3
      std/haxe/CallStack.hx

+ 4 - 3
std/haxe/CallStack.hx

@@ -56,12 +56,13 @@ abstract CallStack(Array<StackItem>) from Array<StackItem> {
 		Return the exception stack : this is the stack elements between
 		Return the exception stack : this is the stack elements between
 		the place the last exception was thrown and the place it was
 		the place the last exception was thrown and the place it was
 		caught, or an empty array if not available.
 		caught, or an empty array if not available.
+		Set `fullStack` parameter to true in order to return the full exception stack.
 
 
 		May not work if catch type was a derivative from `haxe.Exception`.
 		May not work if catch type was a derivative from `haxe.Exception`.
 	**/
 	**/
-	public static function exceptionStack():Array<StackItem> {
+	public static function exceptionStack( fullStack = false ):Array<StackItem> {
 		var eStack:CallStack = NativeStackTrace.toHaxe(NativeStackTrace.exceptionStack());
 		var eStack:CallStack = NativeStackTrace.toHaxe(NativeStackTrace.exceptionStack());
-		return eStack.subtract(callStack()).asArray();
+		return (fullStack ? eStack : eStack.subtract(callStack())).asArray();
 	}
 	}
 
 
 	/**
 	/**
@@ -181,4 +182,4 @@ abstract CallStack(Array<StackItem>) from Array<StackItem> {
 				b.add(n);
 				b.add(n);
 		}
 		}
 	}
 	}
-}
+}