Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions internal/assertions/panic.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package assertions

import (
"fmt"
"runtime"
"runtime/debug"
)

Expand Down Expand Up @@ -133,10 +134,8 @@ func didPanic(f func()) (didPanic bool, message any, stack string) {
}
// Go 1.21 introduces runtime.PanicNilError on panic(nil),
// so maintain the same logic going forward (https://github.com/golang/go/issues/25448).
if err, ok := message.(error); ok {
if err.Error() == "panic called with nil argument" {
message = nil
}
if _, ok := message.(*runtime.PanicNilError); ok {
message = nil
}
}()

Expand Down
Loading