(err error)
| 28 | } |
| 29 | |
| 30 | func errorToCode(err error) ErrorCode { |
| 31 | switch { |
| 32 | case err == nil: |
| 33 | return ErrorCodeNoError |
| 34 | case errors.Is(err, ErrNoSuchFile): |
| 35 | return ErrorCodeNoSuchFile |
| 36 | case errors.Is(err, ErrInvalid): |
| 37 | return ErrorCodeInvalidFile |
| 38 | default: |
| 39 | return ErrorCodeGeneric |
| 40 | } |
| 41 | } |