]> cat aescling's git repositories - mastodon.git/commitdiff
Ignore AbortError when cancelled sharing (#6978)
authorunarist <m.unarist@gmail.com>
Sat, 31 Mar 2018 11:16:38 +0000 (20:16 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Sat, 31 Mar 2018 11:16:38 +0000 (13:16 +0200)
`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

index cd59c7845f9dface6b0daedd7ae93f00a99aa8f1..e036dc1da4acb52aae6e9597315e9786391eb6aa 100644 (file)
@@ -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);
     });
   }