Add missing rejection handling for Promises (#7008)
* Add eslint-plugin-promise to detect uncaught rejections * Move alert generation for errors to actions/alert * Add missing rejection handling for Promises * Use catch() instead of onReject on then() Then it will catches rejection from onFulfilled. This detection can be disabled by `allowThen` option, though.
This commit is contained in:
		
					parent
					
						
							
								e7a1716701
							
						
					
				
			
			
				commit
				
					
						2c51bc0ca5
					
				
			
		
					 13 changed files with 84 additions and 44 deletions
				
			
		|  | @ -27,6 +27,7 @@ import { initReport } from '../actions/reports'; | |||
| import { openModal } from '../actions/modal'; | ||||
| import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; | ||||
| import { boostModal, deleteModal } from '../initial_state'; | ||||
| import { showAlertForError } from '../actions/alerts'; | ||||
| 
 | ||||
| const messages = defineMessages({ | ||||
|   deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, | ||||
|  | @ -83,7 +84,10 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ | |||
|   }, | ||||
| 
 | ||||
|   onEmbed (status) { | ||||
|     dispatch(openModal('EMBED', { url: status.get('url') })); | ||||
|     dispatch(openModal('EMBED', { | ||||
|       url: status.get('url'), | ||||
|       onError: error => dispatch(showAlertForError(error)), | ||||
|     })); | ||||
|   }, | ||||
| 
 | ||||
|   onDelete (status) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue