Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Commit

Permalink
return empty object instead of server error
Browse files Browse the repository at this point in the history
  • Loading branch information
refs committed Mar 12, 2020
1 parent 1c32865 commit 1324b9f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/store/filesystem/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,14 @@ func (s Store) List() ([]*proto.Record, error) {

// Read implements the store interface. This implementation only reads by id.
func (s Store) Read(key string) (*proto.Record, error) {
record := proto.Record{}
contents, err := ioutil.ReadFile(path.Join(s.mountPath, key))
if err != nil {
s.Logger.Err(err).Msgf("error reading contents of key %v: file not found", key)
return nil, err
}

record := proto.Record{}
if err = json.Unmarshal(contents, &record); err != nil {
s.Logger.Err(err).Msg("error unmarshaling record")
return nil, err
}

return &record, nil
Expand Down

0 comments on commit 1324b9f

Please sign in to comment.