Skip to content

Commit

Permalink
Fix --log-format parsing
Browse files Browse the repository at this point in the history
I broke it at stellar#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 stellar#228
and stellar#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 committed Jul 17, 2024
1 parent c8965d0 commit 4e8f415
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", err)
}
case LogFormat:
cfg.LogFormat = v
case *LogFormat:
Expand Down

0 comments on commit 4e8f415

Please sign in to comment.