aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Cobo <toqueteos@gmail.com>2015-10-15 17:52:19 +0200
committerCarlos Cobo <toqueteos@gmail.com>2015-10-15 17:52:19 +0200
commit5f5ad88bf2babe506f927d64d2b7a1e1493dc2ae (patch)
treea79a04e39b98bed8d6c7fb753e3fd9548068d8fe
parenta2014124ca3b3f9ff28fbab0a83ce3c71bf4622e (diff)
downloadgo-git-5f5ad88bf2babe506f927d64d2b7a1e1493dc2ae.tar.gz
Remove duplicate NotFoundError and rename it to ErrNotFound (idiomatic)
Error had to be defined in its own package to avoid import cycles.
-rw-r--r--client.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/client.go b/client.go
index ad7536f..f9708c7 100644
--- a/client.go
+++ b/client.go
@@ -7,6 +7,7 @@ import (
"net/url"
"strings"
+ "github.com/tyba/srcd-crawler/clients/common"
"github.com/tyba/srcd-crawler/clients/git/pktline"
"github.com/sourcegraph/go-vcsurl"
@@ -35,7 +36,7 @@ func (c *Client) Refs() (*Refs, error) {
}
if res.StatusCode >= 400 {
- return nil, &NotFoundError{c.url}
+ return nil, &common.ErrNotFound{c.url}
}
defer res.Body.Close()
@@ -150,14 +151,6 @@ func (c *Client) applyHeadersToRequest(req *http.Request, content *strings.Reade
}
}
-type NotFoundError struct {
- url string
-}
-
-func (e NotFoundError) Error() string {
- return e.url
-}
-
type Refs struct {
defaultBranch string
branches map[string]string