Commit bbac0dfc authored by Mark Tyneway's avatar Mark Tyneway

state-surgery: handle fs errors

Handle errors when walking the filesystem so that they do
not silently fail.
parent 3fc87053
......@@ -67,7 +67,7 @@ func (h *Hardhat) init() error {
func (h *Hardhat) initDeployments() error {
for _, deploymentPath := range h.DeploymentPaths {
fileSystem := os.DirFS(filepath.Join(deploymentPath, h.network))
fs.WalkDir(fileSystem, ".", func(path string, d fs.DirEntry, err error) error {
err := fs.WalkDir(fileSystem, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
......@@ -95,6 +95,9 @@ func (h *Hardhat) initDeployments() error {
h.deployments = append(h.deployments, &deployment)
return nil
})
if err != nil {
return err
}
}
return nil
}
......@@ -104,7 +107,7 @@ func (h *Hardhat) initDeployments() error {
func (h *Hardhat) initArtifacts() error {
for _, artifactPath := range h.ArtifactPaths {
fileSystem := os.DirFS(artifactPath)
fs.WalkDir(fileSystem, ".", func(path string, d fs.DirEntry, err error) error {
err := fs.WalkDir(fileSystem, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
......@@ -130,6 +133,9 @@ func (h *Hardhat) initArtifacts() error {
h.artifacts = append(h.artifacts, &artifact)
return nil
})
if err != nil {
return err
}
}
return nil
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment