Better errors for basedir
This commit is contained in:
parent
13ecfb9113
commit
5259ae0689
@ -2,7 +2,6 @@
|
||||
package basedir
|
||||
|
||||
import "os"
|
||||
import "errors"
|
||||
import "path/filepath"
|
||||
|
||||
// Var is an XDG environment variable.
|
||||
@ -21,10 +20,15 @@ func (v Var) Value () string {
|
||||
return os.Getenv(string(v))
|
||||
}
|
||||
|
||||
// ErrEmpty indicaties a path is empty.
|
||||
var ErrEmpty = errors.New("path is not absolute")
|
||||
// ErrNotAbs indicates a path is not absolute.
|
||||
var ErrNotAbs = errors.New("path is not absolute")
|
||||
type basedirError string
|
||||
func (err basedirError) Error () string { return string(err) }
|
||||
|
||||
const (
|
||||
// ErrEmpty indicaties a path is empty.
|
||||
ErrEmpty = basedirError("path is empty")
|
||||
// ErrNotAbs indicates a path is not absolute.
|
||||
ErrNotAbs = basedirError("path is not absolute")
|
||||
)
|
||||
|
||||
// Valid returns an error if the path is not absolute (beginning from '/') or if
|
||||
// it is otherwise invalid.
|
||||
|
Loading…
Reference in New Issue
Block a user