Fix getApi error handling
This commit is contained in:
		
							parent
							
								
									ab452d985c
								
							
						
					
					
						commit
						1d365ea374
					
				| @ -151,17 +151,17 @@ async function getApi(path,auth = false) { | |||||||
|         log(`resp.status: ${resp.status}`) |         log(`resp.status: ${resp.status}`) | ||||||
|         log(`resp.json: ${json}`) |         log(`resp.json: ${json}`) | ||||||
|         if (resp.status != 200) { |         if (resp.status != 200) { | ||||||
|  |             log(`lib.main: getApi: Response status: ${resp.status}`) | ||||||
|             return resp.status |             return resp.status | ||||||
|         } |         } | ||||||
|         if (!resp.ok) { |         if (!resp.ok) { | ||||||
|  |             log(`lib.main: getApi: Fetch error`) | ||||||
|             return false |             return false | ||||||
|         } |         } | ||||||
|         if (json === "[]") { |  | ||||||
|             return 'empty' |  | ||||||
|         } |  | ||||||
|         return json; |         return json; | ||||||
|     } catch(err) { |     } catch(err) { | ||||||
|         return false |         log(`lib.main: getApi: Caught fetch error.  Status: ${resp.status}`) | ||||||
|  |         return resp.status | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user