router/service: handle not found error (#1770)
This commit is contained in:
parent
58845d7012
commit
a64078b5c3
@ -4,10 +4,12 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/micro/go-micro/v2/client"
|
"github.com/micro/go-micro/v2/client"
|
||||||
|
"github.com/micro/go-micro/v2/errors"
|
||||||
"github.com/micro/go-micro/v2/router"
|
"github.com/micro/go-micro/v2/router"
|
||||||
pb "github.com/micro/go-micro/v2/router/service/proto"
|
pb "github.com/micro/go-micro/v2/router/service/proto"
|
||||||
)
|
)
|
||||||
@ -226,8 +228,9 @@ func (s *svc) Lookup(q ...router.QueryOption) ([]router.Route, error) {
|
|||||||
},
|
},
|
||||||
}, s.callOpts...)
|
}, s.callOpts...)
|
||||||
|
|
||||||
// errored out
|
if verr, ok := err.(*errors.Error); ok && verr.Code == http.StatusNotFound {
|
||||||
if err != nil {
|
return nil, router.ErrRouteNotFound
|
||||||
|
} else if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user