improved error handling
This commit is contained in:
		
							parent
							
								
									c6338d1850
								
							
						
					
					
						commit
						0042c85838
					
				
							
								
								
									
										21
									
								
								main.js
								
								
								
								
							
							
						
						
									
										21
									
								
								main.js
								
								
								
								
							| 
						 | 
					@ -1291,10 +1291,16 @@ function init()
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
			.catch(err =>
 | 
								.catch(err =>
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					console.log(err);
 | 
										if (err == "Authent failed")
 | 
				
			||||||
					settings.password = prompt("Password: ", settings.password);
 | 
										{
 | 
				
			||||||
					savesettings();
 | 
											settings.password = prompt("Password: ", settings.password);
 | 
				
			||||||
					init();
 | 
											savesettings();
 | 
				
			||||||
 | 
											init();
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										else
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											showtemporaryinfo(err);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
| 
						 | 
					@ -1387,10 +1393,6 @@ function queryremote(params)
 | 
				
			||||||
							failed("Remote handler returned an error: " + data.error);
 | 
												failed("Remote handler returned an error: " + data.error);
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					else if (data.warning)
 | 
					 | 
				
			||||||
					{
 | 
					 | 
				
			||||||
						console.warn("Remote warning: " + data.warning);
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
					else
 | 
										else
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						apply(data);
 | 
											apply(data);
 | 
				
			||||||
| 
						 | 
					@ -1398,7 +1400,8 @@ function queryremote(params)
 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
				.catch( error =>
 | 
									.catch( error =>
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					failed("Handler result is not valid. JS error: " + error);
 | 
										failed("Could not decrypt or parse data file.");
 | 
				
			||||||
 | 
										console.error(error);
 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue