📄 error.java
字号:
package com.bv.api;/** * A list of the errors that may be returned by the server. * @author C. Oattes */public enum Error { /** * Not yet set */ NotSet(-3, "Not Set"), /** * Error Unknown. */ UnknownError(-2, "Unknown Error"), /** * There has been a problem connecting to the server. */ ConnectionError(-1, "Error connecting to server"), /** * No Error returned (Call completed successfully) */ NoError(0, "No Error"), /** * Invalid UAID */ InvalidUAID(1, "Invalid UAID"), /** * UAID has not been activated, or has become inactive */ InactiveUAID(2, "Inactive UAID"), /** * User does not have enough credit for the requested action */ NotEnoughCredit(3, "Not enough Credit"), /** * One of the parameters passed was either out of the required range, or invalid */ IncorrectParam(4, "Incorrect Parameter"), ProjectDoesNotExist(5, "Project not exist"), NoMobileNumber(6, "User does not have a mobile number"), /** * An unspecified error occured within the server */ InternalError(13, "Internal Error"), /** * The API method has been deactivated */ InactiveMethod(69, "Inactive API Method"); private int code; private String message; private Error(int code, String message) { this.code = code; this.message = message; } /** * Get the error message. * @return The error message. */ public String getMessage() { return message; } /** * Get the error code * @return The error code */ public int getCode() { return code; } /** * Get the Error associated with the code * @param code The code to look up * @return The error with id <code>code</code> */ public static Error getError(String code) { int intCode = Integer.parseInt(code); return getError(intCode); } /** * Get the Error associated with the code * @param code The code to look up * @return The error with id <code>code</code> */ public static Error getError(int code) { for(Error e : Error.values()) { if(e.getCode() == code) { return e; } } return UnknownError; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -