gpt4 book ai didi

javascript - 可读的 Angular.js 错误?

转载 作者:可可西里 更新时间:2023-11-01 02:01:53 24 4
gpt4 key购买 nike

Angular.js 默认不提供人类可读的错误消息。

有没有办法将默认的、神秘的 Angular.js 异常 URL 更改为更易读的错误消息?事实上,我必须复制 URL,删除前缀,然后粘贴到浏览器中以查看问题所在。

例如,将下面的异常转化为更有用的错误信息:

Error: [ng:areq] http://errors.angularjs.org/1.3.0/ng/areq?p0=InterfaceController&p1=not%20a%20function%2C%20got%20undefined y/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular....

类似于:

"Missing required argument to InterfaceController"

我知道我可以提供我自己的异常处理程序:

.factory('$exceptionHandler', function () {
return function errorCatcherHandler(exception, cause) {
console.error(exception);
};
});

我是不是处理错了?

最佳答案

问题是我正在针对缩小/压缩版本进行开发(假设它与其他 JS 库一样)。 未压缩 版本包含一条可读的错误消息。

https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js
https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.js

关于javascript - 可读的 Angular.js 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26512323/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com