diff options
author | 2023-11-08 14:32:17 +0000 | |
---|---|---|
committer | 2023-11-08 14:32:17 +0000 | |
commit | e9e5dc5a40926e5320cb131b035c46b1e1b0bd59 (patch) | |
tree | 52edc9fa5742f28e1e5223f51cda628ec1c35a24 /internal/ap/properties.go | |
parent | [chore]: Bump github.com/spf13/cobra from 1.7.0 to 1.8.0 (#2338) (diff) | |
download | gotosocial-e9e5dc5a40926e5320cb131b035c46b1e1b0bd59.tar.xz |
[feature] add support for polls + receiving federated status edits (#2330)
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...)) +} |