相关疑难解决方法(0)

如何获取缩小的javascript堆栈跟踪并针对源映射运行它以获取正确的错误?

在我们的生产服务器上,我已经缩小了javascript的发布,并且我没有包含它的地图文件,因为我不希望用户能够根据错误了解发生了什么.

我有一个日志服务我写的是通过电子邮件将角度异常(由$ exceptionHandler捕获)转发给自己.但是,此堆栈跟踪几乎不可读:

n is not defined
    at o (http://localhost:9000/build/app.min.js:1:3284)
    at new NameController (http://localhost:9000/build/app.min.js:1:3412)
    at e (http://localhost:9000/build/bower.min.js:44:193)
    at Object.g.instantiate (http://localhost:9000/build/bower.min.js:44:310)
    at b.$get (http://localhost:9000/build/bower.min.js:85:313)
    at d.compile (http://localhost:9000/build/bower.min.js:321:23333)
    at aa (http://localhost:9000/build/bower.min.js:78:90)
    at K (http://localhost:9000/build/bower.min.js:67:39)
    at g (http://localhost:9000/build/bower.min.js:59:410)
    at http://localhost:9000/build/bower.min.js:58:480 <ui-view class="ng-scope">
Run Code Online (Sandbox Code Playgroud)

我想知道的是:是否有一个程序,我可以通过地图文件(或不通过地图文件,如果有另一种方式)分析这个堆栈跟踪与实际的非缩小源代码

javascript minify angularjs

27
推荐指数
4
解决办法
4771
查看次数

使用源映射时以字符串形式获取堆栈跟踪?

为了尽可能多地从错误中获取信息,我想捕获堆栈跟踪以显示在浏览器控制台中,并将其发送到外部记录器服务。

console.error(myError)当浏览器正确解释源映射文件并且堆栈跟踪显示相关文件名时,第一种情况工作正常。

但是,当我尝试使用 获取堆栈跟踪作为字符串时(new Error()).stack,文件名不相关:

My Error
at applicationError (http://localhost:3000/static/js/main.chunk.js:29259:
at http://localhost:3000/static/js/main.chunk.js:1624:
at onError (http://localhost:3000/static/js/0.chunk.js:82415:3)
at apiCall (http://localhost:3000/static/js/0.chunk.js:82449:12)
at async http://localhost:3000/static/js/main.chunk.js:26165:21
at async App.componentWillMount (http://localhost:3000/static/js/main.chunk.js:246:5)
Run Code Online (Sandbox Code Playgroud)

如何获取“已解析”堆栈跟踪,以便将相关信息发送到我的记录器?

我已经看到了这些问题,但是,虽然这个问题乍一看似乎很相关,但没有一个回答我的问题:

javascript error-handling stack-trace node.js reactjs

5
推荐指数
1
解决办法
864
查看次数