From 11fb74804139c6475f95c3d5ec10ac86252324a9 Mon Sep 17 00:00:00 2001 From: unarist Date: Sat, 31 Mar 2018 20:16:38 +0900 Subject: [PATCH] Ignore AbortError when cancelled sharing (#6978) `navigator.share()` rejects Promise if user cancelled sharing, and it may print it as an error on JavaScript console. This patch ignores it and prints other errors on the console. --- app/javascript/mastodon/components/status_action_bar.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/javascript/mastodon/components/status_action_bar.js b/app/javascript/mastodon/components/status_action_bar.js index cd59c7845f..e036dc1da4 100644 --- a/app/javascript/mastodon/components/status_action_bar.js +++ b/app/javascript/mastodon/components/status_action_bar.js @@ -67,6 +67,8 @@ export default class StatusActionBar extends ImmutablePureComponent { navigator.share({ text: this.props.status.get('search_index'), url: this.props.status.get('url'), + }).catch((e) => { + if (e.name !== 'AbortError') console.error(e); }); }