ToError translates an Error to a corresponding error value. TODO(b/34162363): Remove this.
()
| 100 | // |
| 101 | // TODO(b/34162363): Remove this. |
| 102 | func (e *Error) ToError() error { |
| 103 | if e == nil { |
| 104 | return nil |
| 105 | } |
| 106 | if e.noTranslation { |
| 107 | panic(fmt.Sprintf("error %q does not support translation", e.message)) |
| 108 | } |
| 109 | err := int(e.errno) |
| 110 | if err == errno.NOERRNO { |
| 111 | return nil |
| 112 | } |
| 113 | if err >= len(linuxBackwardsTranslations) || !linuxBackwardsTranslations[err].ok { |
| 114 | panic(fmt.Sprintf("unknown error %q (%d)", e.message, err)) |
| 115 | } |
| 116 | return linuxBackwardsTranslations[err].err |
| 117 | } |
| 118 | |
| 119 | // ToLinux converts the Error to a Linux ABI error that can be returned to the |
| 120 | // application. |
no outgoing calls
no test coverage detected