github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/protobuf/protoc-gen-go-grain/templates/error.tmpl (about) 1 {{ range .Errors }} 2 3 {{ if .HasComment }}{{ .Comment }}{{ end -}} 4 func Err{{ .CamelValue }}(format string, args ...interface{}) *cluster.GrainErrorResponse { 5 return cluster.NewGrainErrorResponse({{ .Name }}_{{ .Value }}.String(), fmt.Sprintf(format, args...)) 6 } 7 8 {{ if .HasComment }}{{ .Comment }}{{ end -}} 9 func Is{{.CamelValue}}(err error) bool { 10 if err == nil { 11 return false 12 } 13 e := cluster.FromError(err) 14 return e.Reason == {{ .Name }}_{{ .Value }}.String() 15 } 16 17 {{- end }}