(code ErrorCode)
| 15 | ) |
| 16 | |
| 17 | func codeToError(code ErrorCode) error { |
| 18 | switch code { |
| 19 | case ErrorCodeNoError: |
| 20 | return nil |
| 21 | case ErrorCodeNoSuchFile: |
| 22 | return ErrNoSuchFile |
| 23 | case ErrorCodeInvalidFile: |
| 24 | return ErrInvalid |
| 25 | default: |
| 26 | return ErrGeneric |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | func errorToCode(err error) ErrorCode { |
| 31 | switch { |