Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch errors thrown in ot.applyOps #399

Merged
merged 1 commit into from
Oct 28, 2020
Merged

Catch errors thrown in ot.applyOps #399

merged 1 commit into from
Oct 28, 2020

Conversation

alecgibson
Copy link
Collaborator

The ot.applyOps utility function directly calls type methods, such as
type.apply. These type methods can potentially throw. This results
in an uncaught error, which we should avoid.

This change wraps the ot.applyOps functionality in a try/catch
block and returns the error, so that it can be handled appropriately.
We add a new ERR_OT_OP_NOT_APPLIED error code for this case.

The `ot.applyOps` utility function directly calls type methods, such as
`type.apply`. These type methods can potentially `throw`. This results
in an uncaught error, which we should avoid.

This change wraps the `ot.applyOps` functionality in a `try`/`catch`
block and returns the error, so that it can be handled appropriately.
We add a new `ERR_OT_OP_NOT_APPLIED` error code for this case.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 97.359% when pulling 922062d on snapshot-throw into 4fa0160 on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants