Commit 1bfb5778 authored by Robert Knight's avatar Robert Knight

Add context to error logged when anchoring fails

If the transcript fails to load in the video player app, it will reject the
`contentReady` promise that the client waits on. The client would then cause the
error to be thrown from `Guest.anchor`. Catch this error and add context to
indicate what has gone wrong.
parent 682c542c
......@@ -566,8 +566,16 @@ export class Guest extends TinyEmitter implements Annotator, Destroyable {
this._sidebarRPC.on('deleteAnnotation', (tag: string) => this.detach(tag));
this._sidebarRPC.on('loadAnnotations', (annotations: AnnotationData[]) =>
annotations.forEach(annotation => this.anchor(annotation))
this._sidebarRPC.on(
'loadAnnotations',
async (annotations: AnnotationData[]) => {
try {
await Promise.all(annotations.map(ann => this.anchor(ann)));
} catch (e) {
/* istanbul ignore next */
console.warn('Failed to anchor annotations:', e);
}
}
);
this._sidebarRPC.on('showContentInfo', (info: ContentInfoConfig) =>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment