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

怎么捕获到报错信息 #7

Closed
zzuzsj opened this issue Apr 1, 2019 · 5 comments
Closed

怎么捕获到报错信息 #7

zzuzsj opened this issue Apr 1, 2019 · 5 comments

Comments

@zzuzsj
Copy link

zzuzsj commented Apr 1, 2019

我想把picgo-core接入到自己的项目中,但是现在提供的钩子里好像无法提供报错信息。
比如我上传的图片路径出错了,picgo可以在命令行里log错误,但是我无法在uploadProgress事件里捕获到错误。
请问是我的用法有问题,还是钩子里确实没有提供错误信息呢

@Molunerfinn
Copy link
Member

Molunerfinn commented Apr 1, 2019

@zzuzsj 我的锅,文档里忘了加 failed 事件,可以通过监听 failed 事件来监听错误事件。不过我忘了给它加回调的error信息了,十分抱歉。会立刻加上。
uploadProgress 里如果传了 -1 则表示上传失败,但不会有更多的错误信息。
相关源码在这里:https://github.com/PicGo/PicGo-Core/blob/dev/src/core/Lifecycle.ts#L32-L33
我这就去更新一下文档。感谢支持!

@Molunerfinn
Copy link
Member

@zzuzsj 稍后更新 v1.2.10 版本就可以通过监听 failed 事件获取错误信息了。

@Molunerfinn
Copy link
Member

文档也已经更新:
image

@zzuzsj
Copy link
Author

zzuzsj commented Apr 1, 2019

好的真是高效的coderthanku so much.你的picgo很好用~

@Molunerfinn
Copy link
Member

如果你写的东西用了picgo之后也是开源的,欢迎贡献到awesome-list!

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

No branches or pull requests

2 participants