@@ -201,8 +201,6 @@ async def invoke(self, context: Context, *, index=0) -> None:
201201 # TODO Docs
202202 if not context .view :
203203 return
204- args , kwargs = await self .parse_args (context , self ._instance , context .view .words , index = index )
205- context .args , context .kwargs = args , kwargs
206204
207205 async def try_run (func , * , to_command = False ):
208206 try :
@@ -213,6 +211,17 @@ async def try_run(func, *, to_command=False):
213211 else :
214212 context .bot .run_event ("command_error" , context , _e )
215213
214+ try :
215+ args , kwargs = await self .parse_args (context , self ._instance , context .view .words , index = index )
216+ except (MissingRequiredArgument , BadArgument ) as e :
217+ if self .event_error :
218+ args_ = [self ._instance , context ] if self ._instance else [context ]
219+ await try_run (self .event_error (* args_ , e ))
220+
221+ context .bot .run_event ("command_error" , context , e )
222+ return
223+
224+ context .args , context .kwargs = args , kwargs
216225 check_result = await self .handle_checks (context )
217226
218227 if check_result is not True :
0 commit comments