errors.go 483 B

12345678910111213141516171819202122
  1. package ini
  2. import "fmt"
  3. // UnableToReadFile is an error indicating that a ini file could not be read
  4. type UnableToReadFile struct {
  5. Err error
  6. }
  7. // Error returns an error message and the underlying error message if present
  8. func (e *UnableToReadFile) Error() string {
  9. base := "unable to read file"
  10. if e.Err == nil {
  11. return base
  12. }
  13. return fmt.Sprintf("%s: %v", base, e.Err)
  14. }
  15. // Unwrap returns the underlying error
  16. func (e *UnableToReadFile) Unwrap() error {
  17. return e.Err
  18. }