improve filters error handling
This commit is contained in:
		
							parent
							
								
									1ce691bec6
								
							
						
					
					
						commit
						cd788b8e32
					
				
					 1 changed files with 106 additions and 117 deletions
				
			
		|  | @ -108,30 +108,19 @@ export default class filters { | |||
| 				); | ||||
| 
 | ||||
| 				// Create promise of downloading.
 | ||||
|         let filter_download = net.download(filter_URL, `JSON`); | ||||
| 				let filter_download = net.download(filter_URL, `JSON`, false, true); | ||||
| 				filter_download | ||||
| 					.then((result) => { | ||||
| 						// Only work when the filter is valid.
 | ||||
| 						if (result) { | ||||
| 							// Write the filter to storage.
 | ||||
| 							secretariat.write(["filters", filter_URL], result, -1); | ||||
|               alerts.log( | ||||
|                 texts.localized( | ||||
|                   `settings_filters_update_status_complete`, | ||||
|                   null, | ||||
|                   [filter_URL], | ||||
|                 ), | ||||
|               ); | ||||
| 							alerts.log(texts.localized(`settings_filters_update_status_complete`,null,[filter_URL])); | ||||
| 						} | ||||
| 					}) | ||||
| 					.catch((error) => { | ||||
| 						// Inform the user of the download failure.
 | ||||
|             alerts.error( | ||||
|               texts.localized(`settings_filters_update_status_failure`, null, [ | ||||
|                 error, | ||||
|                 filter_URL, | ||||
|               ]), | ||||
|             ); | ||||
| 						alerts.error(error.name, texts.localized(`settings_filters_update_status_failure`, null, [error.name, filter_URL]), error.stack); | ||||
| 					}); | ||||
| 			} | ||||
| 		} else { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue