From ed47c630bf1536b283ce07951bb28187fd6c2a5d Mon Sep 17 00:00:00 2001 From: Vincent Batoufflet Date: Sat, 6 Aug 2016 14:15:42 +0200 Subject: [PATCH] Expose 'value does not exists' error --- section.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/section.go b/section.go index f5a69aa..1e86d1c 100644 --- a/section.go +++ b/section.go @@ -8,6 +8,11 @@ import ( "strings" ) +var ( + // ErrNotExists represents a nonexistent value error + ErrNotExists = errors.New("value does not exist") +) + // Section struct holds a map of values type Section struct { comments []string @@ -95,7 +100,7 @@ func (section *Section) Get(name string) (Value, error) { value, ok := section.values[name] var err error if ok == false { - err = errors.New("value does not exist") + err = ErrNotExists } return value, err }