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[hertz]: default error code #82

Closed
rogerogers opened this issue Aug 28, 2023 · 2 comments
Closed

question[hertz]: default error code #82

rogerogers opened this issue Aug 28, 2023 · 2 comments

Comments

@rogerogers
Copy link
Collaborator

if err != nil {
utils.SendErrResponse(ctx, c, consts.StatusOK, err)
return
}
{{end}}
{{if eq $MethodInfo.OutputDir "" -}}
resp,err := service.New{{$MethodInfo.Name}}Service(ctx, c).Run(&req)
if err != nil {
utils.SendErrResponse(ctx, c, consts.StatusOK, err)
return
}
{{else}}
resp,err := {{$MethodInfo.OutputDir}}.New{{$MethodInfo.Name}}Service(ctx, c).Run(&req)
if err != nil {
utils.SendErrResponse(ctx, c, consts.StatusOK, err)
return
}

Should "bind error" be the default status code 400, and should "service error" be the default 500?

@li-jin-gou
Copy link
Member

Currently encountered a lot of internal practices are uniformly return 200, and then use the business status code to control the reporting of errors.

@rogerogers
Copy link
Collaborator Author

Got it, thanks

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

No branches or pull requests

2 participants