File: native_unwrap1.13%2B.go

package info (click to toggle)
golang-github-grpc-ecosystem-go-grpc-prometheus 1.2.0%2Bgit20191002.6af20e3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 264 kB
  • sloc: makefile: 34; sh: 11
file content (17 lines) | stat: -rw-r--r-- 359 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// +build go1.13

package grpcstatus

import (
	"errors"
	"google.golang.org/grpc/status"
)

func unwrapNativeWrappedGRPCStatus(err error) (*status.Status, bool) {
	// Unwrapping the native Go unwrap interface
	var unwrappedStatus gRPCStatus
	if ok := errors.As(err, &unwrappedStatus); ok {
		return unwrappedStatus.GRPCStatus(), true
	}
	return nil, false
}