Disable stacktrace in validation exception
This commit is contained in:
parent
b1b191a6e7
commit
d6f1aa70db
@ -26,24 +26,28 @@ import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
|
|||||||
* Exception from method validations
|
* Exception from method validations
|
||||||
*/
|
*/
|
||||||
public class TelegramApiValidationException extends TelegramApiException {
|
public class TelegramApiValidationException extends TelegramApiException {
|
||||||
private PartialBotApiMethod method;
|
|
||||||
|
public static final StackTraceElement[] EMPTY_STACK_TRACE = new StackTraceElement[0];
|
||||||
|
private PartialBotApiMethod<?> method;
|
||||||
private BotApiObject object;
|
private BotApiObject object;
|
||||||
|
|
||||||
public TelegramApiValidationException(String message, PartialBotApiMethod method) {
|
public TelegramApiValidationException(String message, PartialBotApiMethod<?> method) {
|
||||||
super(message);
|
super(message);
|
||||||
this.method = method;
|
this.method = method;
|
||||||
|
this.setStackTrace(new StackTraceElement[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TelegramApiValidationException(String message, BotApiObject object) {
|
public TelegramApiValidationException(String message, BotApiObject object) {
|
||||||
super(message);
|
super(message);
|
||||||
this.object = object;
|
this.object = object;
|
||||||
|
this.setStackTrace(EMPTY_STACK_TRACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BotApiObject getObject() {
|
public BotApiObject getObject() {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PartialBotApiMethod getMethod() {
|
public PartialBotApiMethod<?> getMethod() {
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,4 +61,9 @@ public class TelegramApiValidationException extends TelegramApiException {
|
|||||||
}
|
}
|
||||||
return super.toString();
|
return super.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Throwable fillInStackTrace() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user