]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms/src/org/argeo/cms/cli/CommandRuntimeException.java
Use runtime namespace context as default.
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / cli / CommandRuntimeException.java
1 package org.argeo.cms.cli;
2
3 import java.util.List;
4
5 /** {@link RuntimeException} referring during a command run. */
6 public class CommandRuntimeException extends RuntimeException {
7 private static final long serialVersionUID = 5595999301269377128L;
8
9 private final DescribedCommand<?> command;
10 private final List<String> arguments;
11
12 public CommandRuntimeException(Throwable e, DescribedCommand<?> command, List<String> arguments) {
13 this(null, e, command, arguments);
14 }
15
16 public CommandRuntimeException(String message, DescribedCommand<?> command, List<String> arguments) {
17 this(message, null, command, arguments);
18 }
19
20 public CommandRuntimeException(String message, Throwable e, DescribedCommand<?> command, List<String> arguments) {
21 super(message == null ? "(" + command.getClass().getName() + " " + arguments.toString() + ")"
22 : message + " (" + command.getClass().getName() + " " + arguments.toString() + ")", e);
23 this.command = command;
24 this.arguments = arguments;
25 }
26
27 public DescribedCommand<?> getCommand() {
28 return command;
29 }
30
31 public List<String> getArguments() {
32 return arguments;
33 }
34
35 }