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.
This commit is contained in:
		
							parent
							
								
									e573bb0990
								
							
						
					
					
						commit
						fb3dc00dda
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
					@ -67,6 +67,8 @@ export default class StatusActionBar extends ImmutablePureComponent {
 | 
				
			||||||
    navigator.share({
 | 
					    navigator.share({
 | 
				
			||||||
      text: this.props.status.get('search_index'),
 | 
					      text: this.props.status.get('search_index'),
 | 
				
			||||||
      url: this.props.status.get('url'),
 | 
					      url: this.props.status.get('url'),
 | 
				
			||||||
 | 
					    }).catch((e) => {
 | 
				
			||||||
 | 
					      if (e.name !== 'AbortError') console.error(e);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue