Javascript 从堆栈跟踪中删除调用
我调用命令:Javascript 从堆栈跟踪中删除调用,javascript,node.js,v8,Javascript,Node.js,V8,我调用命令: arguments.callee 我得到一个错误: (node:1956) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments obj
arguments.callee
我得到一个错误:
(node:1956) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
(node:1956) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我对如何使用参数有点困惑。callee
我想做什么?我试图操纵堆栈跟踪。我想删除最新的函数调用(如果可能的话?)
我读过,但它并没有让我变得更聪明。唯一“修改”调用堆栈的方法是调用函数并从函数返回
您看到的错误是由在严格模式下运行的代码引起的。这意味着您在该函数的作用域内有“use strict”
。现在还不清楚你是否真的需要用它来做你想做的事情
如果您试图通过一些修改将当前调用堆栈获取为字符串,则可以对字符串而不是调用堆栈进行这些修改:
var stack=Error().stack;
// ... 修改堆栈
您不能使用参数。被调用方
来修改堆栈跟踪,也不能使用参数。被调用方
来避免异常。