From 8393fc2096135ab59c5077ed521fe5d256846b26 Mon Sep 17 00:00:00 2001 From: Alejandro Figueroa Date: Fri, 2 Sep 2016 17:35:14 -0400 Subject: [PATCH] Pass error on 404 instead of nil Fixes #3 --- nsone.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/nsone.go b/nsone.go index 7187bbc..90da8e9 100644 --- a/nsone.go +++ b/nsone.go @@ -154,12 +154,7 @@ func (c APIClient) GetZones() ([]Zone, error) { // GetZone takes a zone and returns a single active zone and its basic configuration details func (c APIClient) GetZone(zone string) (*Zone, error) { z := NewZone(zone) - status, err := c.doHTTPUnmarshal("GET", fmt.Sprintf("https://api.nsone.net/v1/zones/%s", z.Zone), nil, z) - if status == 404 { - z.Id = "" - z.Zone = "" - return z, nil - } + _, err := c.doHTTPUnmarshal("GET", fmt.Sprintf("https://api.nsone.net/v1/zones/%s", z.Zone), nil, z) return z, err } @@ -274,12 +269,7 @@ func (c APIClient) GetMonitoringJobs() (MonitoringJobs, error) { // GetMonitoringJob takes an ID and returns details for a specific monitoring job func (c APIClient) GetMonitoringJob(id string) (MonitoringJob, error) { var mj MonitoringJob - status, err := c.doHTTPUnmarshal("GET", fmt.Sprintf("https://api.nsone.net/v1/monitoring/jobs/%s", id), nil, &mj) - if status == 404 { - mj.Id = "" - mj.Name = "" - return mj, nil - } + _, err := c.doHTTPUnmarshal("GET", fmt.Sprintf("https://api.nsone.net/v1/monitoring/jobs/%s", id), nil, &mj) return mj, err }