Page MenuHomePhabricator

Make TransactionProcessor#process distinguish recoverable and non-recoverable exceptions
Closed, DeclinedPublic

Description

Make TransactionProcessor#process distinguish recoverable (transaction did not apply, but we restored the surface to the previous state and you can keep working on it) and non-recoverable (something terrible happened and your surface is hosed) exceptions.

(Filing as a note to self, see T187690#4046653)

Event Timeline

I started working on this, but after some more thought, I'm not really sure whether this is a good use of my time and worth the increase in complexity.

Here's a WIP patch that makes ve.dm.TransactionProcessor#process return an Error instead of throwing, and introduces ve.dm.Document#tryCommit that also returns instead of throwing.

But from this point it would still be a lot of work to actually use this new function, since it's usually deep in the call stack – for the example that started this task, it goes ve.ce.Surface#afterPaste → ve.dm.SurfaceFragment#insertContent → ve.dm.SurfaceFragment#change → ve.dm.Surface#change → ve.dm.Surface#changeInternal → ve.dm.Document#commit, and at each of these levels we'd have to introduce some option to return the error instead of throwing it.