mirror of
https://github.com/datarhei/core.git
synced 2025-10-16 13:00:37 +08:00
Fix error if history file doesn't exist
This commit is contained in:
@@ -2,6 +2,7 @@ package session
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
@@ -39,8 +40,12 @@ func NewHistorySource(fs fs.Filesystem, path string) (SnapshotSource, error) {
|
||||
path: path,
|
||||
}
|
||||
|
||||
if _, err := s.fs.Stat(s.path); err == os.ErrNotExist {
|
||||
return nil, nil
|
||||
if _, err := s.fs.Stat(s.path); err != nil {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data, err := s.fs.ReadFile(s.path)
|
||||
|
Reference in New Issue
Block a user