ReferenceError: printStackTrace is not defined

ReferenceError: printStackTrace is not defined

我收到以下错误 "ReferenceError: printStackTrace is not defined", 当我尝试在 angular 应用程序中使用 StackTrace 时。

stacktrace.js 更改了 v1.0 的 API。

您需要使用

var callback = function(frames) { console.log(frames); };
var errback = function(err) { console.log(err.message); };

StackTrace.get().then(callback).catch(errback);

the docs 所建议。

如果您只想解析一个 Error,您可以使用 error-stack-parser

如果您使用的是旧版本,请参考v0.x -> v1.x migration guide

顺便说一下,如果您需要使用版本 0.x,您可以在 GitHub

the stable branch 中找到它