2020-10-14 01:38:44 +02:00
|
|
|
package it.tdlight.tdlibsession.td;
|
|
|
|
|
2020-10-14 20:04:23 +02:00
|
|
|
import it.tdlight.jni.TdApi;
|
|
|
|
import it.tdlight.jni.TdApi.Error;
|
|
|
|
|
2020-10-14 01:38:44 +02:00
|
|
|
public class TdError extends RuntimeException {
|
|
|
|
|
2020-10-14 20:04:23 +02:00
|
|
|
private final int code;
|
|
|
|
private final String message;
|
|
|
|
|
2020-10-14 01:38:44 +02:00
|
|
|
public TdError(int code, String message) {
|
|
|
|
super(code + " " + message);
|
2020-10-14 20:04:23 +02:00
|
|
|
this.code = code;
|
|
|
|
this.message = message;
|
2020-10-14 01:38:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public TdError(int code, String message, Throwable cause) {
|
|
|
|
super(code + " " + message, cause);
|
2020-10-14 20:04:23 +02:00
|
|
|
this.code = code;
|
|
|
|
this.message = message;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getTdCode() {
|
|
|
|
return code;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getTdMessage() {
|
|
|
|
return message;
|
|
|
|
}
|
|
|
|
|
|
|
|
public TdApi.Error getTdError() {
|
|
|
|
return new Error(code, message);
|
2020-10-14 01:38:44 +02:00
|
|
|
}
|
|
|
|
}
|