File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
src/main/java/org/comroid/commands/impl Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 11package org .comroid .commands .impl ;
22
3+ import lombok .SneakyThrows ;
34import lombok .ToString ;
45import lombok .Value ;
56import lombok .experimental .NonFinal ;
3435import org .comroid .commands .node .Node ;
3536import org .jetbrains .annotations .Nullable ;
3637
38+ import java .lang .reflect .InvocationTargetException ;
3739import java .lang .reflect .Method ;
3840import java .lang .reflect .Parameter ;
3941import java .util .ArrayList ;
@@ -183,6 +185,7 @@ public final Stream<AutoFillOption> autoComplete(
183185 return execute (usage , namedArgs );
184186 }
185187
188+ @ SneakyThrows
186189 public final @ Nullable Object execute (CommandUsage usage , @ Nullable Map <String , Object > namedArgs ) {
187190 Object result = null , response ;
188191 try {
@@ -222,6 +225,10 @@ public final Stream<AutoFillOption> autoComplete(
222225
223226 // execute method
224227 result = response = call .getCallable ().invoke (call .getTarget (), useArgs );
228+ } catch (InvocationTargetException itex ) {
229+ if (itex .getCause () instanceof CommandError err )
230+ response = err .getResponse () == null ? tryHandleThrowable (usage , err ) : err .getResponse ();
231+ else throw itex ;
225232 } catch (CommandError err ) {
226233 response = err .getResponse () == null ? tryHandleThrowable (usage , err ) : err .getResponse ();
227234 } catch (Throwable e ) {
You can’t perform that action at this time.
0 commit comments