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:
parent
32158bcef2
commit
94d674fd4c
@ -9,6 +9,9 @@ var errorsTemplate = `
|
|||||||
{{ range .Errors }}
|
{{ range .Errors }}
|
||||||
|
|
||||||
func Is{{.CamelValue}}(err error) bool {
|
func Is{{.CamelValue}}(err error) bool {
|
||||||
|
if err == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
e := errors.FromError(err)
|
e := errors.FromError(err)
|
||||||
return e.Reason == {{.Name}}_{{.Value}}.String() && e.Code == {{.HTTPCode}}
|
return e.Reason == {{.Name}}_{{.Value}}.String() && e.Code == {{.HTTPCode}}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user