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

pull/1706/head
JerryZhou 3 years ago committed by GitHub
parent 32158bcef2
commit 94d674fd4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      cmd/protoc-gen-go-errors/template.go

@ -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}}
}

Loading…
Cancel
Save