{"action":"created","issue":{"url":"https://api.github.com/repos/share/sharedb/issues/259","repository_url":"https://api.github.com/repos/share/sharedb","labels_url":"https://api.github.com/repos/share/sharedb/issues/259/labels{/name}","comments_url":"https://api.github.com/repos/share/sharedb/issues/259/comments","events_url":"https://api.github.com/repos/share/sharedb/issues/259/events","html_url":"https://github.com/share/sharedb/pull/259","id":381135147,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxMTczNzc1","number":259,"title":"Catch synchronous errors in `Doc._otApply`","user":{"login":"alecgibson","id":12036746,"node_id":"MDQ6VXNlcjEyMDM2NzQ2","avatar_url":"https://avatars0.githubusercontent.com/u/12036746?v=4","gravatar_id":"","url":"https://api.github.com/users/alecgibson","html_url":"https://github.com/alecgibson","followers_url":"https://api.github.com/users/alecgibson/followers","following_url":"https://api.github.com/users/alecgibson/following{/other_user}","gists_url":"https://api.github.com/users/alecgibson/gists{/gist_id}","starred_url":"https://api.github.com/users/alecgibson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alecgibson/subscriptions","organizations_url":"https://api.github.com/users/alecgibson/orgs","repos_url":"https://api.github.com/users/alecgibson/repos","events_url":"https://api.github.com/users/alecgibson/events{/privacy}","received_events_url":"https://api.github.com/users/alecgibson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-11-15T12:15:11Z","updated_at":"2018-11-21T17:36:28Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/share/sharedb/pulls/259","html_url":"https://github.com/share/sharedb/pull/259","diff_url":"https://github.com/share/sharedb/pull/259.diff","patch_url":"https://github.com/share/sharedb/pull/259.patch"},"body":"Fixes https://github.com/share/sharedb/issues/257\r\n\r\nAs outlined in the above issue, calling `Doc.submitOp` can sometimes\r\n`throw` a synchronous error, for example when submitting an invalid op\r\nthat causes `type.apply` to `throw`.\r\n\r\nThis is surprising behaviour, because an error handler should already be\r\nprovided in the callback supplied to `submitOp`. What's more, the doc\r\ncould be left partially mutated and out-of-sync with the server, which\r\ncould lead to confusing behaviour.\r\n\r\nThis change wraps all internal usage of `Doc._otApply` in `try`/`catch`\r\nblocks. If an error is thrown in this method, then we attempt to\r\nrecover with `Doc._hardRollback`, which will attempt to reset the\r\ndocument and then call the callbacks of the pending ops with the error.\r\n\r\nThis change also prevents `Doc._hardRollback` from emitting an error if\r\nat least one pending op callback was invoked, so that we don't branch\r\nerror handling behaviour."},"comment":{"url":"https://api.github.com/repos/share/sharedb/issues/comments/440751089","html_url":"https://github.com/share/sharedb/pull/259#issuecomment-440751089","issue_url":"https://api.github.com/repos/share/sharedb/issues/259","id":440751089,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MDc1MTA4OQ==","user":{"login":"alecgibson","id":12036746,"node_id":"MDQ6VXNlcjEyMDM2NzQ2","avatar_url":"https://avatars0.githubusercontent.com/u/12036746?v=4","gravatar_id":"","url":"https://api.github.com/users/alecgibson","html_url":"https://github.com/alecgibson","followers_url":"https://api.github.com/users/alecgibson/followers","following_url":"https://api.github.com/users/alecgibson/following{/other_user}","gists_url":"https://api.github.com/users/alecgibson/gists{/gist_id}","starred_url":"https://api.github.com/users/alecgibson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alecgibson/subscriptions","organizations_url":"https://api.github.com/users/alecgibson/orgs","repos_url":"https://api.github.com/users/alecgibson/repos","events_url":"https://api.github.com/users/alecgibson/events{/privacy}","received_events_url":"https://api.github.com/users/alecgibson/received_events","type":"User","site_admin":false},"created_at":"2018-11-21T17:36:28Z","updated_at":"2018-11-21T17:36:28Z","author_association":"NONE","body":"As discussed, we should check that **every** op has a callback. If any of them don't, then we should emit an error (so that no errors are ever swallowed)."}}
{"actor":{"display_login":"alecgibson"}}