io.agora.rtm.ErrorInfo Maven / Gradle / Ivy
package io.agora.rtm;
import io.agora.rtm.RtmConstants.RtmErrorCode;
/**
* The warning or error code and description.
*/
public class ErrorInfo {
/**
* The error code of current operation.
* @see io.agora.rtm.RtmConstants.RtmErrorCode
*/
private RtmErrorCode errorCode;
/**
* The reason for operation failure.
*/
private String reason = "";
/**
* Current operation.
*/
private String operation = "";
/**
* Constructs a new instance of RtmErrorCode with the specified errorCode.
*
* @param errorCode The error code of ErrorInfo(which is saved for later
* retrieval by the {@link #getErrorCode()} method)
*/
public ErrorInfo(RtmErrorCode errorCode) {
this.errorCode = errorCode;
}
/**
* Constructs a new instance of RtmErrorCode with the specified errorCode and
* specified reason detail.
*
* @param errorCode The error code of ErrorInfo (which is saved for later
* retrieval by the {@link #getErrorCode()} method)
* @param reason A string describing the reason for operation operation failure(which is saved
* for later
* retrieval by the {@link #getErrorReason()} method)
*/
public ErrorInfo(RtmErrorCode errorCode, String reason) {
this.errorCode = errorCode;
this.reason = reason;
}
/**
* Constructs a new instance of RtmErrorCode with the specified errorCode,
* specified reason detail and specified operation.
*
* @param errorCode The error code of ErrorInfo (which is saved for later
* retrieval by the {@link #getErrorCode()} method)
* @param reason A string describing the reason for operation failure(which is saved for later
* retrieval by the {@link #getErrorReason()} method)
* @param operation Current operation(which is saved for later retrieval by the
* {@link #getOperation()} method)
*/
public ErrorInfo(RtmErrorCode errorCode, String reason, String operation) {
this.errorCode = errorCode;
this.reason = reason;
this.operation = operation;
}
/**
* Retrieves the warning or error code.
*
* @return The warning or error code. See {@link RtmConstants.RtmErrorCode} for a list of
* warning or error codes.
*/
public RtmErrorCode getErrorCode() {
return this.errorCode;
}
/**
* Retrieves the warning or error reason.
*
* @return The warning or error reason. See {@link RtmConstants.RtmErrorCode} for a list of
* warning or error codes.
*/
public String getErrorReason() {
return this.reason;
}
/**
* Retrieves current operation.
*
* @return current operation.
*/
public String getOperation() {
return this.operation;
}
@Override
public String toString() {
return "RTM ERROR: " + operation + " failed, error code: " + errorCode + ", reason: " + reason;
}
}