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

Update listeners don't use the exception sink #1287

Closed
Monkatraz opened this issue Oct 25, 2023 · 1 comment
Closed

Update listeners don't use the exception sink #1287

Monkatraz opened this issue Oct 25, 2023 · 1 comment

Comments

@Monkatraz
Copy link

Monkatraz commented Oct 25, 2023

Describe the issue

You can create an exception sink which is supposed to receive extension errors, but EditorView.updateListener doesn't actually use the sink despite being an extension. Instead, if an updateListener throws it just causes the entire dispatch to throw, rather than unmounting the listener, like a view plugin.

I genuinely feel like this is a bug, so I'm making an issue. I've attached a reproduction that demonstrates this. The sink won't be called despite the listener throwing on every keystroke. Something to note is that despite the listener throwing, the update is still "successful", which I feel like is strange result if technically the update method is throwing.

Browser and platform

No response

Reproduction link

https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge2phdmFzY3JpcHR9IGZyb20gIkBjb2RlbWlycm9yL2xhbmctamF2YXNjcmlwdCIKCmNvbnN0IHNpbmsgPSBFZGl0b3JWaWV3LmV4Y2VwdGlvblNpbmsub2YoKGVycikgPT4gewogIGNvbnNvbGUubG9nKCdJIGdvdCBhbiBlcnJvciEnLCBlcnIpCn0pCgpjb25zdCBiYWRMaXN0ZW5lciA9IEVkaXRvclZpZXcudXBkYXRlTGlzdGVuZXIub2YoKHVwZGF0ZSkgPT4gewogIGlmICh1cGRhdGUuZG9jQ2hhbmdlZCkgewogICAgdGhyb3cgbmV3IEVycm9yKCd3aG9vcHMnKQogIH0KfSkKCm5ldyBFZGl0b3JWaWV3KHsKICBkb2M6ICJjb25zb2xlLmxvZygnaGVsbG8nKVxuIiwKICBleHRlbnNpb25zOiBbYmFzaWNTZXR1cCwgamF2YXNjcmlwdCgpLCBzaW5rLCBiYWRMaXN0ZW5lcl0sCiAgcGFyZW50OiBkb2N1bWVudC5ib2R5Cn0pCg==

@marijnh
Copy link
Member

marijnh commented Oct 26, 2023

Agreed that it would make sense to catch exceptions there. Attached patch implements this.

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

No branches or pull requests

2 participants