errors.go

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