AndroidAPS/app/src/main/java/de/jotomo/ruffyscripter/commands/CommandException.java
Johannes Mockenhaupt f41d597c07
Formatting.
2017-08-17 10:58:21 +02:00

51 lines
1.2 KiB
Java

package de.jotomo.ruffyscripter.commands;
public class CommandException extends RuntimeException {
public boolean success = false;
public boolean enacted = false;
public Exception exception = null;
public String message = null;
public CommandException() {
}
public CommandException success(boolean success) {
this.success = success;
return this;
}
public CommandException enacted(boolean enacted) {
this.enacted = enacted;
return this;
}
public CommandException exception(Exception exception) {
this.exception = exception;
return this;
}
@Override
public String getMessage() {
return message;
}
public CommandException message(String message) {
this.message = message;
return this;
}
public CommandResult toCommandResult() {
return new CommandResult().success(success).enacted(enacted).exception(exception).message(message);
}
@Override
public String toString() {
return "CommandException{" +
"success=" + success +
", enacted=" + enacted +
", exception=" + exception +
", message='" + message + '\'' +
'}';
}
}