Skip to content

Commit 63f68aa

Browse files
committed
[must] fix invalid error messages of the NoErr and OK methods
Change-Id: I60d1738c916ddf9fd187072980f1205f1e2df6e4
1 parent 67f1519 commit 63f68aa

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

must/no-err.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ import (
1717
// must.OK(json.Unmarshal([]byte(`["totally", "valid", "data"]`), &data))
1818
func NoErr(err error) {
1919
if err != nil {
20-
panic(e.NewFrom("OK assurance failed", err))
20+
panic(e.NewFrom("NoErr assurance failed", err))
2121
}
2222
}

must/no-error_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestNoErr(t *testing.T) {
2929
})
3030

3131
assert.ErrorIs(t, err, errTestError)
32-
assert.Equal(t, "OK assurance failed: test error", err.Error())
32+
assert.Equal(t, "NoErr assurance failed: test error", err.Error())
3333
}
3434

3535
func errorFn1() error {

must/ok.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
// u = must.OK(url.Parse("example.com"))
1818
func OK[T any](v T, err error) T { //nolint:ireturn
1919
if err != nil {
20-
panic(e.NewFrom("no error assurance failed", err))
20+
panic(e.NewFrom("OK assurance failed", err))
2121
}
2222

2323
return v

must/ok_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestOK(t *testing.T) {
2626
})
2727

2828
assert.ErrorIs(t, err, errTestError)
29-
assert.Equal(t, "no error assurance failed: test error", err.Error())
29+
assert.Equal(t, "OK assurance failed: test error", err.Error())
3030
}
3131

3232
var errTestError = errors.New("test error")

0 commit comments

Comments
 (0)