forked from TrueCloudLab/distribution
Use typecast over reflect for error type checking
Signed-off-by: Edgar Lee <edgar.lee@docker.com>
This commit is contained in:
parent
8160a430be
commit
45b84c9512
1 changed files with 2 additions and 2 deletions
|
@ -6,7 +6,6 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"reflect"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/docker/distribution/registry/api/errcode"
|
"github.com/docker/distribution/registry/api/errcode"
|
||||||
|
@ -48,8 +47,9 @@ func (ch *catalogHandler) GetCatalog(w http.ResponseWriter, r *http.Request) {
|
||||||
repos := make([]string, maxEntries)
|
repos := make([]string, maxEntries)
|
||||||
|
|
||||||
filled, err := ch.App.registry.Repositories(ch.Context, repos, lastEntry)
|
filled, err := ch.App.registry.Repositories(ch.Context, repos, lastEntry)
|
||||||
|
_, pathNotFound := err.(driver.PathNotFoundError)
|
||||||
|
|
||||||
if err == io.EOF || reflect.TypeOf(err) == reflect.TypeOf(driver.PathNotFoundError{}) {
|
if err == io.EOF || pathNotFound {
|
||||||
moreEntries = false
|
moreEntries = false
|
||||||
} else if err != nil && err != storage.ErrFinishedWalk {
|
} else if err != nil && err != storage.ErrFinishedWalk {
|
||||||
ch.Errors = append(ch.Errors, errcode.ErrorCodeUnknown.WithDetail(err))
|
ch.Errors = append(ch.Errors, errcode.ErrorCodeUnknown.WithDetail(err))
|
||||||
|
|
Loading…
Reference in a new issue