botserver: Add specific error message for unedited zuliprcs.
Previously, when a user tried to run the Botserver with a zuliprc but forgot to set the bot name, they were told to edit the botserverrc file. However, the recommended approach is to specify the botname with the -b option. This commit adds an error message specific for this case. It recognizes zuliprc files by their section header `api`.
This commit is contained in:
		
							parent
							
								
									3ddc8f9b5d
								
							
						
					
					
						commit
						242bcdbadc
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -57,10 +57,11 @@ 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:
 | 
			
		||||
            sys.exit(
 | 
			
		||||
                "Error: Bot \"{}\" doesn't exist. "
 | 
			
		||||
                "Please make sure you have set up the botserverrc file correctly.\n".format(bot)
 | 
			
		||||
            )
 | 
			
		||||
            error_message = ("Error: Bot \"{}\" doesn't exist. Please make sure "
 | 
			
		||||
                             "you have set up the botserverrc file correctly.\n".format(bot))
 | 
			
		||||
            if bot == "api":
 | 
			
		||||
                error_message += "Did you forget to specify the bot you want to run with -b <botname> ?"
 | 
			
		||||
            sys.exit(error_message)
 | 
			
		||||
    return bots_lib_module
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue