throw new CommandException(ErrorKind.SYNTAX, "Syntax exception when executing command " + name, e); } catch (InvocationException e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e.getCause());
@Override public void set(Object target, Object[] args, Object value) throws InvocationException { try { field.setAccessible(true); field.set(target, value); } catch (Exception e) { throw new InvocationException(e.getMessage(), e); } } }
public void open2(final CommandContext<P> consumer) throws CommandException { // invocationContext = new InvocationContextImpl<P>(consumer); // Push context command.pushContext(invocationContext); // Set the unmatched part command.unmatched = invoker.getMatch().getRest(); // PC ret; try { ret = invoker.invoke(this); } catch (org.crsh.cli.impl.SyntaxException e) { throw new CommandException(ErrorKind.SYNTAX, "Syntax exception when executing command " + name, e); } catch (InvocationException e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e.getCause()); } // It's a pipe command if (ret != null) { real = ret; try { real.open(invocationContext); } catch (Exception e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e); } } }
public Void invoke(Instance<T> commandInstance) throws InvocationException, SyntaxException { T command; try { command = commandInstance.get(); } catch (Exception e) { throw new InvocationException(e); } MethodDescriptor.bind(match, getParameters(), command, Util.EMPTY_ARGS); Runnable runnable = Runnable.class.cast(command); try { runnable.run(); } catch (Exception e) { throw new InvocationException(e); } return null; } };
throw new CommandException(ErrorKind.SYNTAX, "Syntax exception when executing command " + name, e); } catch (InvocationException e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e.getCause());
throw new InvocationException(e); throw (Error)t; } else { throw new InvocationException(t); throw new InvocationException(t);
throw new CommandException(ErrorKind.SYNTAX, "Syntax exception when executing command " + name, e); } catch (InvocationException e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e.getCause());
@Override public void set(Object target, Object[] args, Object value) throws InvocationException { try { field.setAccessible(true); field.set(target, value); } catch (Exception e) { throw new InvocationException(e.getMessage(), e); } } }
public void open2(final CommandContext<P> consumer) throws CommandException { // invocationContext = new InvocationContextImpl<P>(consumer); // Push context command.pushContext(invocationContext); // Set the unmatched part command.unmatched = invoker.getMatch().getRest(); // PC ret; try { ret = invoker.invoke(this); } catch (org.crsh.cli.impl.SyntaxException e) { throw new CommandException(ErrorKind.SYNTAX, "Syntax exception when executing command " + name, e); } catch (InvocationException e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e.getCause()); } // It's a pipe command if (ret != null) { real = ret; try { real.open(invocationContext); } catch (Exception e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e); } } }
@Override public Object invoke(Resolver resolver, T command) throws InvocationException, SyntaxException { configure(match, command); Runnable runnable = Runnable.class.cast(command); try { runnable.run(); } catch (Exception e) { throw new InvocationException(e); } return null; } };
public void open2(final CommandContext<P> consumer) throws CommandException { // invocationContext = new InvocationContextImpl<P>(consumer); // Push context command.pushContext(invocationContext); // Set the unmatched part command.unmatched = invoker.getMatch().getRest(); // PC ret; try { ret = invoker.invoke(this); } catch (org.crsh.cli.impl.SyntaxException e) { throw new CommandException(ErrorKind.SYNTAX, "Syntax exception when executing command " + name, e); } catch (InvocationException e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e.getCause()); } // It's a pipe command if (ret != null) { real = ret; try { real.open(invocationContext); } catch (Exception e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e); } } }
throw new InvocationException(e);
throw new org.crsh.command.SyntaxException(e.getMessage()); } catch (InvocationException e) { throw toScript(e.getCause());
public Void invoke(Instance<T> commandInstance) throws InvocationException, SyntaxException { T command; try { command = commandInstance.get(); } catch (Exception e) { throw new InvocationException(e); } MethodDescriptor.bind(match, getParameters(), command, Util.EMPTY_ARGS); Runnable runnable = Runnable.class.cast(command); try { runnable.run(); } catch (Exception e) { throw new InvocationException(e); } return null; } };
throw new InvocationException(e); throw (Error)t; } else { throw new InvocationException(t); throw new InvocationException(t);
throw (Error)t; } else { throw new InvocationException(t); throw new InvocationException(t);
void configure(InvocationMatch<T> classMatch, T command) throws InvocationException, SyntaxException { for (ParameterDescriptor parameter : getParameters()) { ParameterMatch match = classMatch.getParameter(parameter); if (match == null) { if (parameter.isRequired()) { if (parameter instanceof ArgumentDescriptor) { ArgumentDescriptor argument = (ArgumentDescriptor)parameter; throw new SyntaxException("Missing argument " + argument.getName()); } else { OptionDescriptor option = (OptionDescriptor)parameter; throw new SyntaxException("Missing option " + option.getNames()); } } } else { Object value = match.computeValue(); Field f = ((ClassFieldBinding)parameter.getBinding()).getField(); try { f.setAccessible(true); f.set(command, value); } catch (Exception e) { throw new InvocationException(e.getMessage(), e); } } } }