Skip to content
Snippets Groups Projects
Unverified Commit 10e14141 authored by Wolfgang Welz's avatar Wolfgang Welz Committed by GitHub
Browse files

Remove usage of pkg/errors (#368)

parent b8c48b20
No related branches found
No related tags found
No related merge requests found
package dashboard
import (
"fmt"
"net/http"
"sync"
"github.com/iotaledger/goshimmer/packages/binary/messagelayer/message"
"github.com/iotaledger/goshimmer/plugins/messagelayer"
"github.com/labstack/echo"
"github.com/pkg/errors"
)
// ExplorerMessage defines the struct of the ExplorerMessage.
......@@ -80,7 +80,7 @@ func setupExplorerRoutes(routeGroup *echo.Group) {
result := &SearchResult{}
if len(search) < 81 {
return errors.Wrapf(ErrInvalidParameter, "search id invalid: %s", search)
return fmt.Errorf("%w: search ID %s", ErrInvalidParameter, search)
}
wg := sync.WaitGroup{}
......@@ -116,14 +116,14 @@ func findMessage(messageID message.Id) (explorerMsg *ExplorerMessage, err error)
if !messagelayer.Tangle.Message(messageID).Consume(func(msg *message.Message) {
explorerMsg, err = createExplorerMessage(msg)
}) {
err = errors.Wrapf(ErrNotFound, "message: %s", messageID.String())
err = fmt.Errorf("%w: message %s", ErrNotFound, messageID.String())
}
return
}
func findAddress(address string) (*ExplorerAddress, error) {
return nil, errors.Wrapf(ErrNotFound, "address %s not found", address)
return nil, fmt.Errorf("%w: address %s", ErrNotFound, address)
// TODO: ADD ADDRESS LOOKUPS ONCE THE VALUE TRANSFER ONTOLOGY IS MERGED
}
package dashboard
import (
"errors"
"fmt"
"io/ioutil"
"net/http"
......@@ -9,7 +10,6 @@ import (
"github.com/gobuffalo/packr/v2"
"github.com/iotaledger/goshimmer/plugins/config"
"github.com/labstack/echo"
"github.com/pkg/errors"
)
// ErrInvalidParameter defines the invalid parameter error.
......@@ -79,7 +79,7 @@ func setupRoutes(e *echo.Echo) {
var statusCode int
var message string
switch errors.Cause(err) {
switch errors.Unwrap(err) {
case echo.ErrNotFound:
c.Redirect(http.StatusSeeOther, "/")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment