Adjust error handling in ToMath vs try (note)

Closes #13239
This commit is contained in:
Bjørn Erik Pedersen
2025-01-09 08:17:40 +01:00
parent 892b49110e
commit dde9d9d544
4 changed files with 38 additions and 38 deletions

View File

@@ -133,22 +133,3 @@ func NewBool(b bool) *bool {
type PrintableValueProvider interface {
PrintableValue() any
}
var _ PrintableValueProvider = Result[any]{}
// Result is a generic result type.
type Result[T any] struct {
// The result value.
Value T
// The error value.
Err error
}
// PrintableValue returns the value or panics if there is an error.
func (r Result[T]) PrintableValue() any {
if r.Err != nil {
panic(r.Err)
}
return r.Value
}