Skip to content

Commit 9b80dd0

Browse files
authored
fix: add not exist check for loadConfigFile error (cosmos#1325)
* fix: add os.IsExist check for err * Update CHANGELOG.md * Apply suggestions from code review
1 parent 26aa983 commit 9b80dd0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* [\#1231](https://github.com/cosmos/relayer/pull/1231) Reduce get bech32 prefix when get signer.
2626
* [\#1302](https://github.com/cosmos/relayer/pull/1302) Avoid packet get relayed when estimated gas is higher than max gas.
2727
* [\#1303](https://github.com/cosmos/relayer/pull/1303) Add missing max gas amount on txf to avoid estimate less gas when simualte runTx.
28+
* [\#1325](https://github.com/cosmos/relayer/pull/1325) Ignore only file not exist error when loadConfigFile.
2829

2930
## v0.9.3
3031

cmd/appstate.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"errors"
77
"fmt"
88
"io"
9+
"io/fs"
910
"os"
1011
"path"
1112

@@ -40,7 +41,10 @@ func (a *appState) loadConfigFile(ctx context.Context) error {
4041

4142
if _, err := os.Stat(cfgPath); err != nil {
4243
// don't return error if file doesn't exist
43-
return nil
44+
if errors.Is(err, fs.ErrNotExist) {
45+
err = nil
46+
}
47+
return err
4448
}
4549

4650
// read the config file bytes

0 commit comments

Comments
 (0)