Skip to content

Commit

Permalink
chore: Log OpenGraph fetching errors (#6066)
Browse files Browse the repository at this point in the history
  • Loading branch information
ffflorian authored Mar 12, 2019
1 parent 1ee04df commit 12588ee
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/script/links/LinkPreviewRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,26 @@ class LinkPreviewRepository {
return window
.openGraphAsync(link)
.then(mergeOpenGraphData)
.catch(() => Promise.resolve());
.catch(error => {
this.logger.warn(`Error while fetching OpenGraph data: ${error.message}`);
return Promise.resolve();
});
}

return new Promise(resolve => {
return window
.openGraph(link, (error, data) => {
if (error) {
this.logger.warn(`Error while fetching OpenGraph data: ${error.message}`);
resolve();
}

resolve(mergeOpenGraphData(data));
})
.catch(resolve);
.catch(error => {
this.logger.warn(`Error while fetching OpenGraph data: ${error.message}`);
resolve(error);
});
});
}

Expand Down

0 comments on commit 12588ee

Please sign in to comment.