I'm currently working on a quick tutorial for OpenCensus involving scaffolding the app with kitgen.
I noticed the generated code does not add an implementation of the Failer interface when an error field for the Response struct is requested. It would be nice to add this feature so middleware can use the endpoint.Failer interface to identify business logic errors.
So a "hello" method like this:
type Service interface {
Hello(ctx context.Context, name string) (greeting string, err error)
}
would generate the following HelloResponse struct:
type HelloResponse struct {
Greeting string
Err error
}
// Failed implements Failer
func (r HelloResponse) Failed() error { return r.Err }
I'm currently working on a quick tutorial for OpenCensus involving scaffolding the app with kitgen.
I noticed the generated code does not add an implementation of the Failer interface when an error field for the Response struct is requested. It would be nice to add this feature so middleware can use the endpoint.Failer interface to identify business logic errors.
So a "hello" method like this:
would generate the following HelloResponse struct: