錯誤代碼編排 (Error Code)

Posted by Yang

原則

當系統發生無法向下運行的錯誤時,若 User 並無要求需顯示對應訊息,則需依以下規定編排錯誤代碼

  • 依功能類別編排首碼英文
  • 依功能排序編排功能待碼
  • 依流程順序決定錯誤編號

範例

  • 帳單查詢為類別「帳單/費用」的第一個功能,並且功能一開始就判斷用戶是否有帳單,當查詢帳單出現錯誤時代碼應為「MA_001_001
try {
    billList = ebppServiceImpl.getBillListByMsisdn(msisdn, "");
} catch (Exception e) {
    CfgErrMsgMap cfgErrMsgMap = 
        cfgErrMsgMapService.searchByErrorCode(ErrorCode.MA_001_001);
    String ebppErr = 
        cfgErrMsgMapService.getEbppMsg(
            billList.getReturnCode(),
            billList.getDescription());

    FailedResultException fail =
        new FailedResultException(cfgErrMsgMap.getErrorCode(), ebppErr);
    LogHandler.error(this.getClass(),
        cfgErrMsgMap.getErrorCode(),
        fail.getMessage(), e);

    throw fail;
}
  • 在與資料庫配合時,需在資料庫中說明此代碼發生時所代表的意義。

資料庫訊息設定

results matching ""

    No results matching ""