Skip to content

Commit

Permalink
Merge pull request tellor-io#284 from developerfred/chore-replace-errors
Browse files Browse the repository at this point in the history
replace erros
  • Loading branch information
themandalore committed Nov 18, 2020
2 parents 68939ca + 6865ee2 commit ab318f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pkg/util/httpRetriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ package util

import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"time"

"github.com/pkg/errors"
)

var httpFetchLog = NewLogger("util", "HTTPFetchWithRetries")
Expand Down Expand Up @@ -65,7 +66,7 @@ func _recReq(req *HTTPFetchRequest, expiration time.Time) ([]byte, error) {
// Log local non-timeout errors for now.
now := time.Now()
if now.After(expiration) {
return nil, fmt.Errorf("Giving up fetch request after request timeout: %d", r.StatusCode)
return nil, errors.Errorf("Giving up fetch request after request timeout: %d", r.StatusCode)
}
// FIXME: should this be configured as fetch error sleep duration?
time.Sleep(500 * time.Millisecond)
Expand Down
6 changes: 4 additions & 2 deletions pkg/util/logConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"encoding/json"
"fmt"
"os"

"github.com/pkg/errors"
)

// Entry holds specific component log level.
Expand All @@ -30,10 +32,10 @@ func ParseLoggingConfig(file string) error {
if len(file) > 0 {
info, err := os.Stat(file)
if os.IsNotExist(err) {
return fmt.Errorf("loggingConfigPath references an invalid file at: %s", file)
return errors.Errorf("loggingConfigPath references an invalid file at: %s", file)
}
if info.IsDir() {
return fmt.Errorf("logging config file %s is a directory", file)
return errors.Errorf("logging config file %s is a directory", file)
}

configFile, err := os.Open(file)
Expand Down

0 comments on commit ab318f7

Please sign in to comment.