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

[Question] How should I judge whether the HTTP request exception is caused by panic? ? #2852

Closed
shuqingzai opened this issue Aug 9, 2023 · 3 comments

Comments

@shuqingzai
Copy link

shuqingzai commented Aug 9, 2023

  1. 在进行错误统一处理时,无法得知 error 是否为 panic 转换而来,且没有可以注册自定义程序处理 panic 引发的异常

参考:

gutil.TryCatch(ctx, func(ctx context.Context) {

func TryCatch(ctx context.Context, try func(ctx context.Context), catch ...func(ctx context.Context, exception error)) {

image

image

1. What version of Go and system type/arch are you using?

2. What version of GoFrame are you using?

3. Can this issue be re-produced with the latest release?

4. What did you do?

5. What did you expect to see?

6. What did you see instead?

@Issues-translate-bot Issues-translate-bot changed the title [Question] 我应该如何判断http请求异常是否为 panic 导致?? [Question] How should I judge whether the HTTP request exception is caused by panic? ? Aug 9, 2023
@LonelySally
Copy link
Member

r.GetError() != nil && r.Response.BufferLength() > 0 可以尝试下组合判断下.这里好像是缺少错误类型的区分.

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


r.GetError() != nil && r.Response.BufferLength() > 0 You can try to judge the combination. It seems that there is a lack of distinction between error types.

@shuqingzai
Copy link
Author

#2860 close #2852

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

3 participants