Skip to content

Commit

Permalink
Fix --log-format parsing (#252)
Browse files Browse the repository at this point in the history
I broke it at #228

It turns out that `github.com/stellar/go/support/errors.Wrapf` returns nil if the error is nil
(which is different to how `errors.Errorf` behaves).

I have looked at both #228
and #224 and this is the
only instance in which we replaced `Wrapf` by `Errorf` where we
don't first check the error for `nil`.
  • Loading branch information
2opremio authored Jul 17, 2024
1 parent c8965d0 commit de7b040
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cmd/soroban-rpc/internal/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@ func (cfg *Config) options() Options {
case nil:
return nil
case string:
return fmt.Errorf(
"could not parse %s: %w",
option.Name,
cfg.LogFormat.UnmarshalText([]byte(v)),
)
if err := cfg.LogFormat.UnmarshalText([]byte(v)); err != nil {
return fmt.Errorf("could not parse %s: %w", option.Name, err)
}
case LogFormat:
cfg.LogFormat = v
case *LogFormat:
Expand Down

0 comments on commit de7b040

Please sign in to comment.