botserver: Make bot-name-not-found error more user-friendly.
Previously, when a bot name wasn't found, the Botserver threw an ImportError with an error message. This results in an intimidating traceback which is in most cases not helpful to the user. This commit replaces the ImportError with sys.exit.
This commit is contained in:
		
							parent
							
								
									c85b42be9f
								
							
						
					
					
						commit
						3ddc8f9b5d
					
				
					 2 changed files with 15 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -57,8 +57,8 @@ def load_lib_modules(available_bots: List[str]) -> Dict[str, Any]:
 | 
			
		|||
            lib_module = import_module(module_name)
 | 
			
		||||
            bots_lib_module[bot] = lib_module
 | 
			
		||||
        except ImportError:
 | 
			
		||||
            raise ImportError(
 | 
			
		||||
                "\nImport Error: Bot \"{}\" doesn't exists. "
 | 
			
		||||
            sys.exit(
 | 
			
		||||
                "Error: Bot \"{}\" doesn't exist. "
 | 
			
		||||
                "Please make sure you have set up the botserverrc file correctly.\n".format(bot)
 | 
			
		||||
            )
 | 
			
		||||
    return bots_lib_module
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue