乙個用列舉型別定義錯誤碼的Demo

2021-08-20 09:29:03 字數 1005 閱讀 8815

/**

* created by gfj43958 on 2017/1/6.

*/ //網路超時

socket_timeout("w001", "網路超時"),

//網路鏈結異常

socket_connect_eroor("w002", "網路鏈結異常"),

//請求引數錯誤

request_arguments_error("w003", "請求引數錯誤"),

//wsdl錯誤

wdsl_error("w004", "wsdl位址錯誤"),

//session建立失敗

session_create_error("w006", "未知錯誤,session建立失敗"),

//session關閉失敗

session_close_error("w007", "未知錯誤,session關閉失敗"),

//token建立失敗

token_create_error("w008", "未知錯誤,token建立失敗"),

//token關閉失敗

token_close_error("w009", "未知錯誤,token關閉失敗"),

//未知錯誤

other_error("w400", "其他錯誤"),

private string errorcode;

private string errormsg;

private string code;

private string msg;

this.code = code;

this.msg = msg;

}public string getcode()

public string getmsg()

public static string getresponsemsg(string code)

}return other_error.getmsg();

}}

乙個處理資料庫異常的類,按照錯誤碼彈出提示資訊

public class myerrorcontext public int geterrorno public string geterrordesc public static final int db er cant create table 1005 建立表失敗 public static ...

乙個C 巨集定義與列舉定義重複的編譯錯誤

c 的開發效率低是眾所周知的,原因比如有 另外乙個恐怕是不少編譯錯誤讓人摸不著頭腦,今天碰到乙個,舉個例子 1 include 2 3enum loglevel 10 1112 intmain 13 16 編譯錯誤為 g ddebug test.cpp test.cpp 7 5 error expe...

用enum關鍵字定義乙個列舉類

案例 前端要傳過來四個同種型別的值,根據值不同,查詢不同的資料,不想在後端 裡直接匹配 春天 equals 改變其硬編碼形式 使用場景 列舉類定義 列舉類 帶有屬性的 public enum season1 3.其他訴求,獲取列舉類物件屬性,final型別的字段不能被set,只有get獲取屬性值的方...