improve error reporting
This commit is contained in:
		
							parent
							
								
									5957c0c94a
								
							
						
					
					
						commit
						16ad91ccc0
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -38,11 +38,13 @@ class ApiWrapper:
 | 
				
			||||||
                case 'fakenews': return self.get_fakenews()
 | 
					                case 'fakenews': return self.get_fakenews()
 | 
				
			||||||
                case 'anek': return self.get_anek()
 | 
					                case 'anek': return self.get_anek()
 | 
				
			||||||
                case 'y_search': return self.y_search(message)
 | 
					                case 'y_search': return self.y_search(message)
 | 
				
			||||||
                case _: return self.FAILED
 | 
					                case _: sys.stderr.write(
 | 
				
			||||||
 | 
					                            f'API failed: called non-existent api {api}'
 | 
				
			||||||
 | 
					                        )
 | 
				
			||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
            e_text = str(e)
 | 
					            e_text = str(e)
 | 
				
			||||||
            sys.stderr.write(f'API failed: {e_text}\n')
 | 
					            sys.stderr.write(f'API failed: {e_text}\n')
 | 
				
			||||||
            return self.FAILED
 | 
					        return self.FAILED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __sanitize_search(self, message: str) -> str:
 | 
					    def __sanitize_search(self, message: str) -> str:
 | 
				
			||||||
        """Removes one of each of the search tokens from the query
 | 
					        """Removes one of each of the search tokens from the query
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue