Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: 优化错误输出 #1002

Closed
Ice-Hazymoon opened this issue Mar 3, 2023 · 11 comments
Closed

Feature: 优化错误输出 #1002

Ice-Hazymoon opened this issue Mar 3, 2023 · 11 comments
Labels
feature 新特性

Comments

@Ice-Hazymoon
Copy link

Describe the problem related to the feature request

88e77d3ae929641cc7aeb4652d118ee

日志根本看不出是哪个插件的问题,然后无限重启,手动 hook 了 axios 才知道是哪个接口 timeout 了

Describe the solution you'd like

优化错误日志输出

Describe alternatives you've considered

No response

Additional context

No response

@Ice-Hazymoon Ice-Hazymoon added the feature 新特性 label Mar 3, 2023
@shigma
Copy link
Member

shigma commented Mar 3, 2023

所以是哪个插件的问题(

@Ice-Hazymoon
Copy link
Author

所以是哪个插件的问题(

T。。。Telegram

@shigma
Copy link
Member

shigma commented Mar 4, 2023

tg 需要你配个代理。不过这个优化确实可以做。

1 similar comment
@shigma
Copy link
Member

shigma commented Mar 4, 2023

tg 需要你配个代理。不过这个优化确实可以做。

@Ice-Hazymoon
Copy link
Author

我认为不是配代理的问题,主要是这个错误 log 没有提供任何有意义的帮助,一报错就无限重启,应该在报错的时候输出插件名,让开发者能更好的定位错误。

@shigma
Copy link
Member

shigma commented Mar 4, 2023

我知道你的意思。但这个优化并不好做,一个错误可能来自一个插件触发的事件在第二个插件注册的回调函数里,错误的成因又是第三个插件提供的 API。目前很难说完全判定某个错误的来源。

所以我希望在保留这个 issue 的同时先尽量解决你的问题本身,再慢慢考虑万全之策。

@ilharp
Copy link
Member

ilharp commented Mar 4, 2023

不过我也很好奇,为什么其他报错都带有带有插件名的堆栈,为什么唯独网络请求没有呢?网络请求是使用事件实现的吗?

@Anillc
Copy link
Member

Anillc commented Mar 4, 2023

大概是因为 polling 是通过 setTimeout 实现的,抛出异常也是在 node 的事件循环里了,所以堆栈不会显示代码的具体位置

@shigma
Copy link
Member

shigma commented Aug 30, 2023

或许用 error.cause 可以解决。

问题在于,许多逻辑依赖了 isAxiosError,如果构造新的 Error 可能会导致插件判断失败。

@shigma
Copy link
Member

shigma commented Aug 30, 2023

尝试解决了一下,下个版本实装。

@CyanChanges
Copy link

之前找了挺久才知道哪里有问题,改了有时间试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 新特性
Projects
None yet
Development

No branches or pull requests

5 participants