Documentation
¶
Overview ¶
Package grpcerr contains the helper for extracting gRPC status code from a semerr.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Code ¶
Code returns grpc status code for err.
Example ¶
package main import ( "errors" "fmt" "github.com/hedhyw/semerr/pkg/v1/grpcerr" "github.com/hedhyw/semerr/pkg/v1/semerr" "google.golang.org/grpc/codes" ) func main() { err := semerr.NewBadRequestError(errors.New("bad request error")) fmt.Println( "Is err invalid argument?", grpcerr.Code(err) == codes.InvalidArgument, ) }
Output: Is err invalid argument? true
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.