Use go_errors library everywhere.
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package gopher
|
||||
|
||||
import (
|
||||
"gemini-grc/errors"
|
||||
)
|
||||
import "github.com/antanst/go_errors"
|
||||
|
||||
// GopherError is an error encountered while
|
||||
// visiting a Gopher host, and is only for
|
||||
@@ -28,5 +26,5 @@ func IsGopherError(err error) bool {
|
||||
return false
|
||||
}
|
||||
var asError *GopherError
|
||||
return errors.As(err, &asError)
|
||||
return go_errors.As(err, &asError)
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ import (
|
||||
"gemini-grc/common/snapshot"
|
||||
_url "gemini-grc/common/url"
|
||||
"gemini-grc/config"
|
||||
"gemini-grc/errors"
|
||||
"gemini-grc/logging"
|
||||
"github.com/antanst/go_errors"
|
||||
"github.com/guregu/null/v5"
|
||||
)
|
||||
|
||||
@@ -118,7 +118,7 @@ func Visit(url string) (*snapshot.Snapshot, error) {
|
||||
func connectAndGetData(url string) ([]byte, error) {
|
||||
parsedURL, err := stdurl.Parse(url)
|
||||
if err != nil {
|
||||
return nil, errors.NewError(err)
|
||||
return nil, go_errors.NewError(err)
|
||||
}
|
||||
|
||||
hostname := parsedURL.Hostname()
|
||||
@@ -169,7 +169,7 @@ func connectAndGetData(url string) ([]byte, error) {
|
||||
data = append(data, buf[:n]...)
|
||||
}
|
||||
if err != nil {
|
||||
if errors.Is(err, io.EOF) {
|
||||
if go_errors.Is(err, io.EOF) {
|
||||
break
|
||||
}
|
||||
return nil, errors2.NewHostError(err)
|
||||
|
||||
Reference in New Issue
Block a user