Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/genesis/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func LoadGenesis(genesisPath string) (Genesis, error) {
// Validate and clean the file path
cleanPath := filepath.Clean(genesisPath)
if _, err := os.Stat(cleanPath); os.IsNotExist(err) {
return Genesis{}, fmt.Errorf("genesis file not found at path: %s", cleanPath)
return Genesis{}, fmt.Errorf("genesis file not found at path %s: %w", cleanPath, err)
}

genesisJSON, err := os.ReadFile(cleanPath)
Expand Down
3 changes: 3 additions & 0 deletions pkg/genesis/io_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ func TestLoadGenesis_FileNotFound(t *testing.T) {
_, err := LoadGenesis("nonexistent.json")
assert.Error(t, err)
assert.Contains(t, err.Error(), "genesis file not found")
assert.ErrorIs(t, err, os.ErrNotExist)
var pathErr *os.PathError
assert.ErrorAs(t, err, &pathErr)
}

func TestLoadGenesis_InvalidJSON(t *testing.T) {
Expand Down
Loading