MCPcopy
hub / github.com/google/gvisor / FromError

Function FromError

pkg/syserr/syserr.go:266–282  ·  view source on GitHub ↗

FromError converts a generic error to an *Error. TODO(b/34162363): Remove this function.

(err error)

Source from the content-addressed store, hash-verified

264//
265// TODO(b/34162363): Remove this function.
266func FromError(err error) *Error {
267 if err == nil {
268 return nil
269 }
270
271 switch e := err.(type) {
272 case unix.Errno:
273 return FromHost(e)
274 case *errors.Error:
275 return FromHost(unix.Errno(e.Errno()))
276 case safecopy.SegvError, safecopy.BusError, safecopy.AlignmentError:
277 return FromHost(unix.EFAULT)
278 }
279
280 msg := fmt.Sprintf("err: %s type: %T", err.Error(), err)
281 panic(msg)
282}

Callers 15

BidirectionalConnectMethod · 0.92
UnidirectionalConnectMethod · 0.92
LoadFunction · 0.92
NewSockfsFileFunction · 0.92
blockingAcceptMethod · 0.92
AcceptMethod · 0.92
BindMethod · 0.92
extractEndpointMethod · 0.92
SendMsgMethod · 0.92
RecvMsgMethod · 0.92
initFromOptionsMethod · 0.92
SendMethod · 0.92

Calls 3

FromHostFunction · 0.85
ErrnoMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…