about summary refs log tree commit diff
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2018-03-31 20:16:38 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-03-31 13:16:38 +0200
commitfb3dc00ddab3f8c1af42ebc0520f6108cc40a1fc (patch)
treef3f0ecfbeb08c26205aca1fb13d91299ff09ad52
parente573bb0990ece4b1a521ccf8a4c7bec5972d3538 (diff)
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.
-rw-r--r--app/javascript/mastodon/components/status_action_bar.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/javascript/mastodon/components/status_action_bar.js b/app/javascript/mastodon/components/status_action_bar.js
index cd59c7845..e036dc1da 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);
     });
   }