ghorg/vendor/github.com/ktrysmt/go-bitbucket/error.go
2020-07-11 09:54:34 -07:00

23 lines
378 B
Go

package bitbucket
import (
"errors"
"github.com/mitchellh/mapstructure"
)
type BitbucketError struct {
Message string
Fields map[string][]string
}
func DecodeError(e map[string]interface{}) error {
var bitbucketError BitbucketError
err := mapstructure.Decode(e["error"], &bitbucketError)
if err != nil {
return err
}
return errors.New(bitbucketError.Message)
}