Skip to content

Commit

Permalink
Merge pull request micro#1659 from micro/config-srv-not-found
Browse files Browse the repository at this point in the history
Handle config service not found errors
  • Loading branch information
ben-toogood authored May 27, 2020
2 parents f00b696 + d85b419 commit 192f548
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion config/source/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package service

import (
"context"
"net/http"

"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/config/source"
proto "github.com/micro/go-micro/v2/config/source/service/proto"
"github.com/micro/go-micro/v2/errors"
"github.com/micro/go-micro/v2/logger"
)

Expand All @@ -29,7 +31,9 @@ func (m *service) Read() (set *source.ChangeSet, err error) {
Namespace: m.namespace,
Path: m.path,
})
if err != nil {
if verr, ok := err.(*errors.Error); ok && verr.Code == http.StatusNotFound {
return nil, nil
} else if err != nil {
return nil, err
}

Expand Down

0 comments on commit 192f548

Please sign in to comment.