Skip to content

Commit

Permalink
return unhanandled error. use errors.is in annotate test
Browse files Browse the repository at this point in the history
  • Loading branch information
facuMH committed Jan 16, 2025
1 parent 21644d1 commit 94bcf0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions cmd/sonictool/genesis/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ func WriteSignatureIntoGenesisFile(header genesis.Header, signature []byte, file
return fmt.Errorf("failed to write signature to genesis file: %w", err)
}
_, err = writer.Flush()
utils.AnnotateIfError(err, "failed to flush genesis file:")
return err
return utils.AnnotateIfError(err, "failed to flush genesis file:")
}

// TypedDataAndHash is a helper function that calculates a hash for typed data conforming to EIP-712.
Expand Down
2 changes: 2 additions & 0 deletions utils/annotateError_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package utils

import (
"errors"
"fmt"
"testing"

Expand All @@ -17,4 +18,5 @@ func TestAnnotateIfError_AddsContextToError(t *testing.T) {
err := fmt.Errorf("someError")
errWithContext := AnnotateIfError(err, "message")
require.ErrorContains(t, errWithContext, "message: someError")
require.True(t, errors.Is(errWithContext, err))
}

0 comments on commit 94bcf0b

Please sign in to comment.