mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-09 22:51:02 +00:00
return orig error instead of cause in handler
also include the invalid name when erroring that a name is invalid.
This commit is contained in:
parent
000c188682
commit
f8a8a5d096
3 changed files with 4 additions and 4 deletions
|
|
@ -347,7 +347,7 @@ func (r *successResponse) check(err error) (statusCode int) {
|
|||
}
|
||||
|
||||
r.Success = false
|
||||
r.Error = &Error{Message: cause.Error()}
|
||||
r.Error = &Error{Message: err.Error()}
|
||||
|
||||
return statusCode
|
||||
}
|
||||
|
|
|
|||
2
index.go
2
index.go
|
|
@ -155,7 +155,7 @@ func (i *Index) openFields() error {
|
|||
|
||||
fld, err := i.newField(i.fieldPath(filepath.Base(fi.Name())), filepath.Base(fi.Name()))
|
||||
if err != nil {
|
||||
return ErrName
|
||||
return errors.Wrapf(ErrName, "'%s'", fi.Name())
|
||||
}
|
||||
if err := fld.Open(); err != nil {
|
||||
return fmt.Errorf("open field: name=%s, err=%s", fld.Name(), err)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ package pilosa
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/pkg/errors"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ const TimeFormat = "2006-01-02T15:04"
|
|||
// validateName ensures that the name is a valid format.
|
||||
func validateName(name string) error {
|
||||
if !nameRegexp.Match([]byte(name)) {
|
||||
return ErrName
|
||||
return errors.Wrapf(ErrName, "'%s'", name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue