MCPcopy
hub / github.com/connectrpc/connect-go / asError

Function asError

error.go:269–273  ·  view source on GitHub ↗

asError uses errors.As to unwrap any error and look for a connect *Error.

(err error)

Source from the content-addressed store, hash-verified

267
268// asError uses errors.As to unwrap any error and look for a connect *Error.
269func asError(err error) (*Error, bool) {
270 var connectErr *Error
271 ok := errors.As(err, &connectErr)
272 return connectErr, ok
273}
274
275// wrapIfUncoded ensures that all errors are wrapped. It leaves already-wrapped
276// errors unchanged, uses wrapIfContextError to apply codes to context.Canceled

Callers 15

grpcErrorToTrailerFunction · 0.85
grpcStatusForErrorFunction · 0.85
CodeOfFunction · 0.85
DecompressMethod · 0.85
CompressMethod · 0.85
MarshalMethod · 0.85
writeMethod · 0.85
UnmarshalMethod · 0.85
ReadMethod · 0.85
mergeResponseHeaderMethod · 0.85
CloseMethod · 0.85
MarshalEndStreamMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestErrorCodeFunction · 0.68