hypothesis / hypothesis/client

Make unexpected errors during anchoring easier to see/debug

Open
#1,370 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Mustache
Stars
730
Forks
224
PR merge metrics
No merged PRs in 30d

Description

Tracking down the anchoring failure in [https://github.com/hypothesis/client/issues/1329] was made more complicated by the fact that all anchoring exceptions are currently [silently swallowed](https://github.com/hypothesis/client/blob/5c363b87391e2bd66d2d346154271c62fc1385da/src/annotator/guest.coffee#L235) in `guest.coffee`.

Anchoring can fail due to both _expected_ issues, such as an xpath selector not matching the current DOM structure, or a quote selector not matching the current document text, but also unexpected exceptions such as the one described in https://github.com/hypothesis/client/issues/1329.

At a minimum, it would be helpful to surface these unexpected issues by logging a console warning.

A better experience still would involve propagating information about the error to the sidebar and then somehow indicating the cause of anchoring failure in the UI. That is out of scope for the initial improvement here.

As part of this work, I think it would be a good idea to convert `guest.coffee` to JS before making additional changes to it.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.