From 20b6f71c5467b8813241495c733b0bbdb598c261 Mon Sep 17 00:00:00 2001 From: Fady Farid Date: Mon, 29 Apr 2019 11:55:38 -0400 Subject: [PATCH] fix: return errors --- dns_records.go | 4 ++-- ssh_key.go | 4 ++-- startup_script.go | 4 ++-- user.go | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dns_records.go b/dns_records.go index 2279b3b..d2b83a1 100644 --- a/dns_records.go +++ b/dns_records.go @@ -48,7 +48,7 @@ func (d *DNSRecordsServiceHandler) Create(ctx context.Context, domain, recordTyp req, err := d.client.NewRequest(ctx, http.MethodPost, uri, values) if err != nil { - return nil + return err } err = d.client.DoWithContext(ctx, req, nil) @@ -73,7 +73,7 @@ func (d *DNSRecordsServiceHandler) Delete(ctx context.Context, domain, recordID req, err := d.client.NewRequest(ctx, http.MethodPost, uri, values) if err != nil { - return nil + return err } err = d.client.DoWithContext(ctx, req, nil) diff --git a/ssh_key.go b/ssh_key.go index 7d395e3..8dfecaf 100644 --- a/ssh_key.go +++ b/ssh_key.go @@ -41,7 +41,7 @@ func (s *SSHKeyServiceHandler) Create(ctx context.Context, name, sshKey string) req, err := s.client.NewRequest(ctx, http.MethodPost, uri, values) if err != nil { - return nil, nil + return nil, err } key := new(SSHKey) @@ -70,7 +70,7 @@ func (s *SSHKeyServiceHandler) Destroy(ctx context.Context, sshKeyID string) err req, err := s.client.NewRequest(ctx, http.MethodPost, uri, values) if err != nil { - return nil + return err } err = s.client.DoWithContext(ctx, req, nil) diff --git a/startup_script.go b/startup_script.go index 72dc906..080bd7f 100644 --- a/startup_script.go +++ b/startup_script.go @@ -70,7 +70,7 @@ func (s *StartupScriptServiceHandler) Create(ctx context.Context, name, script, req, err := s.client.NewRequest(ctx, http.MethodPost, uri, values) if err != nil { - return nil, nil + return nil, err } ss := new(StartupScript) @@ -102,7 +102,7 @@ func (s *StartupScriptServiceHandler) Destroy(ctx context.Context, scriptID stri req, err := s.client.NewRequest(ctx, http.MethodPost, uri, values) if err != nil { - return nil + return err } err = s.client.DoWithContext(ctx, req, nil) diff --git a/user.go b/user.go index d2e46b6..a746a84 100644 --- a/user.go +++ b/user.go @@ -50,7 +50,7 @@ func (u *UserServiceHandler) Create(ctx context.Context, email, name, password, req, err := u.client.NewRequest(ctx, http.MethodPost, uri, values) if err != nil { - return nil, nil + return nil, err } user := new(User) @@ -81,7 +81,7 @@ func (u *UserServiceHandler) Delete(ctx context.Context, userID string) error { req, err := u.client.NewRequest(ctx, http.MethodPost, uri, values) if err != nil { - return nil + return err } err = u.client.DoWithContext(ctx, req, nil)