浏览代码

Update CallStack.hx

Nicolas Cannasse 4 年之前
父节点
当前提交
99e59a951b
共有 1 个文件被更改,包括 4 次插入3 次删除
  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);
 		}
 		}
 	}
 	}
-}
+}