Skip to content

Commit

Permalink
Regroup errors, NewHostingv4 returns a Hostingv4 object
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloPie committed May 30, 2019
1 parent 3daab22 commit 625835b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
3 changes: 1 addition & 2 deletions hosting/hostingv4/diskv4.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ func (h Hostingv4) DeleteDisk(disk hosting.Disk) error {

// ExtendDisk extends `disk.Size` by `size` (original size + `size`)
//
// Disks cannot shrink in size
// `size` is in GB
// Disks cannot shrink in size, `size` is in GB
func (h Hostingv4) ExtendDisk(disk hosting.Disk, size uint) (hosting.Disk, error) {
var fn = "ExtendDisk"
if disk.ID == "" {
Expand Down
25 changes: 13 additions & 12 deletions hosting/hostingv4/hostingv4.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ import (
"strconv"

"github.com/PabloPie/go-gandi/client"
"github.com/PabloPie/go-gandi/hosting"
)

// ErrNotProvided indicates that a value was not provided but was needed, e.g,
// mandatory fields in a struct
var ErrNotProvided = errors.New("Not provided")
var (
// ErrNotProvided indicates that a value was not provided but was needed,
// e.g, mandatory fields in a struct
ErrNotProvided = errors.New("Not provided")

// ErrParse indicates that there was an error transforming a value from a struct,
// usually coming from a string to integer conversion
var ErrParse = errors.New("Parsing error")
// ErrParse indicates that there was an error transforming a value from a struct,
// usually coming from a string to integer conversion
ErrParse = errors.New("Parsing error")

// ErrMismatch indicates that two values that should be equal are not,
// for example when working when distinct objects that have to be in the
// same datacenter
var ErrMismatch = errors.New("Value mismatch")
// ErrMismatch indicates that two values that should be equal are not,
// for example when working when distinct objects that have to be in the
// same datacenter
ErrMismatch = errors.New("Value mismatch")
)

// A Hostingv4 contains an xmlrpc client to send requests to
type Hostingv4 struct {
Expand Down Expand Up @@ -50,7 +51,7 @@ func internalParseError(s string, f string) error {
//
// Initialized with a reusable client that contains the actual
// xmlrpc client that will be used to send the requests
func Newv4Hosting(client client.V4Caller) hosting.Hosting {
func Newv4Hosting(client client.V4Caller) Hostingv4 {
return Hostingv4{client}
}

Expand Down

0 comments on commit 625835b

Please sign in to comment.