diff options
Diffstat (limited to 'internal/ap/properties.go')
-rw-r--r-- | internal/ap/properties.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/internal/ap/properties.go b/internal/ap/properties.go index d8441003f..788b8ac4e 100644 --- a/internal/ap/properties.go +++ b/internal/ap/properties.go @@ -24,6 +24,7 @@ import ( "github.com/superseriousbusiness/activity/streams" "github.com/superseriousbusiness/activity/streams/vocab" + "github.com/superseriousbusiness/gotosocial/internal/gtserror" ) // MustGet performs the given 'Get$Property(with) (T, error)' signature function, panicking on error. @@ -36,12 +37,12 @@ import ( // } // MustSet performs the given 'Set$Property(with, T) error' signature function, panicking on error. -// func MustSet[W, T any](fn func(W, T) error, with W, value T) { -// err := fn(with, value) -// if err != nil { -// panicfAt(3, "error setting property on %T: %w", with, err) -// } -// } +func MustSet[W, T any](fn func(W, T) error, with W, value T) { + err := fn(with, value) + if err != nil { + panicfAt(3, "error setting property on %T: %w", with, err) + } +} // AppendSet performs the given 'Append$Property(with, ...T) error' signature function, panicking on error. // func MustAppend[W, T any](fn func(W, ...T) error, with W, values ...T) { @@ -320,6 +321,6 @@ func appendIRIs[T TypeOrIRI](getProp func() Property[T], iri ...*url.URL) { } // panicfAt panics with a call to gtserror.NewfAt() with given args (+1 to calldepth). -// func panicfAt(calldepth int, msg string, args ...any) { -// panic(gtserror.NewfAt(calldepth+1, msg, args...)) -// } +func panicfAt(calldepth int, msg string, args ...any) { + panic(gtserror.NewfAt(calldepth+1, msg, args...)) +} |