mirror of
https://github.com/gabrie30/ghorg.git
synced 2025-08-13 09:47:11 +02:00
23 lines
378 B
Go
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)
|
|
}
|