type StreamErrorHandlerFunc … type StreamError … type ProtoErrorHandlerFunc … var _ … // DefaultHTTPProtoErrorHandler is an implementation of HTTPError. // If "err" is an error from gRPC system, the function replies with the status code mapped by HTTPStatusFromCode. // If otherwise, it replies with http.StatusInternalServerError. // // The response body returned by this function is a Status message marshaled by a Marshaler. // // Do not set this function to HTTPError variable directly, use WithProtoErrorHandler option instead. func DefaultHTTPProtoErrorHandler(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, _ *http.Request, err error) { … } // DefaultHTTPStreamErrorHandler converts the given err into a *StreamError via // default logic. // // It extracts the gRPC status from err if possible. The fields of the status are // used to populate the returned StreamError, and the HTTP status code is derived // from the gRPC code via HTTPStatusFromCode. If the given err does not contain a // gRPC status, an "Unknown" gRPC code is used and "Internal Server Error" HTTP code. func DefaultHTTPStreamErrorHandler(_ context.Context, err error) *StreamError { … }