Merge pull request #11457 from stepancheg:state-file

PiperOrigin-RevId: 726147631
This commit is contained in:
gVisor bot
2025-02-12 12:15:52 -08:00
+5 -1
View File
@@ -383,8 +383,12 @@ func (s *StateFile) load(v any, opts LoadOpts) error {
}
defer s.UnlockOrDie()
metaBytes, err := os.ReadFile(s.statePath())
path := s.statePath()
metaBytes, err := os.ReadFile(path)
if err != nil {
// Caller of this function relies on error code, we cannot return new error,
// but we need to provide a message with file name.
log.Warningf("Error loading state file %q: %v", path, err)
return err
}
return json.Unmarshal(metaBytes, &v)