Err converts the status to a Go error and returns nil if the status is OK.
()
| 49 | |
| 50 | // Err converts the status to a Go error and returns nil if the status is OK. |
| 51 | func (s *status) Err() error { |
| 52 | if s == nil || s.Code() == C.TF_OK { |
| 53 | return nil |
| 54 | } |
| 55 | return (*statusError)(s) |
| 56 | } |
| 57 | |
| 58 | // statusError is distinct from status because it fulfills the error interface. |
| 59 | // status itself may have a TF_OK code and is not always considered an error. |