1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-14 02:33:03 +02:00

fix(cmd/proto-gen-errors): non nil assertion for error (#1700)

This commit is contained in:
JerryZhou 2021-12-20 11:10:01 +08:00 committed by GitHub
parent 32158bcef2
commit 94d674fd4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,9 @@ var errorsTemplate = `
{{ range .Errors }}
func Is{{.CamelValue}}(err error) bool {
if err == nil {
return false
}
e := errors.FromError(err)
return e.Reason == {{.Name}}_{{.Value}}.String() && e.Code == {{.HTTPCode}}
}