mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-13 23:23:29 +01:00
perform(synchronous:) is not a rethrowing method as documented #159
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sidmani on GitHub (Aug 15, 2017).
The documentation for
DataStack.perform(synchronous:)states:"Any errors thrown from inside the
taskwill be rethrown fromperform(synchronous:)".However, the signature is marked
throws, notrethrows.public func perform<T>(synchronous task: ((_ transaction: SynchronousDataTransaction) throws -> T), waitForAllObservers: Bool = true) throws -> TDocumentation error?
@JohnEstropia commented on GitHub (Aug 15, 2017):
perform(synchronous:)just promises to "rethrow", that is to propagate, any errors youthrowfrom inside the closure, not that it accepts non-throwing closures. It's explicitlythrowsbecausethrow transaction.cancel()rethrowsgives the illusion that non-throwing closures will never fail, which is not true (save errors may still be emitted)@sidmani commented on GitHub (Aug 15, 2017):
Gotcha, I think changing the word "rethrow" to "propagate" or something in the doc would make it clearer since rethrows is a keyword.
@JohnEstropia commented on GitHub (Aug 15, 2017):
Thanks, I see the confusion. Will reword similar places in the documentations 👍