Check for a failed transaction part

What would be the elegant way of checking, if my Transaction.insert() failed apart from checking, if a new ReplaceStep was added to the transaction? Failure in my case would be due to schema restrictions.

Checking for .steps.length is the proper way. If you’re calling maybeStep directly, the result will give you this information, but insert will just return the transaction and thus won’t provide you this information.

if it fits your use case there is also safeInsert implemented by a third party library prosemirror-utils.

Thanks for pointing me to that library. I will have a look at it.