Browse Source

Merge pull request #34 from vbatoufflet/expose-error

Expose 'value does not exists' error
master v0.2.2
Brett Langdon 9 years ago
committed by GitHub
parent
commit
eec119e2c2
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      section.go

+ 6
- 1
section.go View File

@ -8,6 +8,11 @@ import (
"strings" "strings"
) )
var (
// ErrNotExists represents a nonexistent value error
ErrNotExists = errors.New("value does not exist")
)
// Section struct holds a map of values // Section struct holds a map of values
type Section struct { type Section struct {
comments []string comments []string
@ -95,7 +100,7 @@ func (section *Section) Get(name string) (Value, error) {
value, ok := section.values[name] value, ok := section.values[name]
var err error var err error
if ok == false { if ok == false {
err = errors.New("value does not exist")
err = ErrNotExists
} }
return value, err return value, err
} }


Loading…
Cancel
Save