1.2.4 • Published 4 years ago

http-message-codes v1.2.4

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Installation

npm install http-message-codes

Usage

const error = require("http-message-codes");
// parameter could be any object (json), string or number
let lang = 'en'                 // -Optional, supported languages en ( English ), cz ( Traditional Chinese ) - default language cz
const { status, result } = error.SUCCESS(parameter, lang);
res.status(status).json(result);
console.log(status);
console.log(result);

HTTP CUSTOM ERROR CODES / MESSAGE

All functions ( SUCCESS, DB_ERROR_GET, etc) accept one optional parameter.

ERROR CODE TABLE

codemessage (Chinese)messge (English)
0成功Success
16資料取得錯誤Error while getting data from the database
17資料新增錯誤Error while posting data to the database
18資料修改錯誤Error while putting data to the database
20預期紀錄未在資料庫找到Record expected but nothing found on database
24紀錄未啟用、無效或未支的狀態Record not active, disabled or unknown status
32處理必要參數時錯誤Error while processing required parameter
33處理Json格式的參數時錯誤Error while processing json formatted parameter
34錯誤的電子信箱格式Wrong email format
36未知的或未支援的參數格式Unknown or unsupported parameter format
40檔案並未上傳File was not uploaded
48檔案類型未支援File type not supported
64參數值無效Parameter value is invalid
65Token無效Token is invalid
66Token已過期Token has expired
96只能選擇現金或點數交易Error trading, order must be paid all in cash or all in points
128移動檔案錯誤Error moving file
160現金不足Parameter cash is not enough to pay the order
256使用者名稱已被使用Username already in used
257拒絕訪問Access denied
258使用者已登入User has already login
260密碼過期Account password has expired and need to be reset
264登入錯誤, 鎖定中Account lock for a period of time
288檔案太大File size is too big
1024服務連結錯誤Error connecting to service
1025憑證授權錯誤Certificate authority error
1026Google firebase 雲訊息傳送失敗Error sending message through Google firebase cloud messaging service
1056點數不足User does not have enough points to pay the order
2048未知的功能,此問題將會回報Unknown function, this issue will be reported
2080參數from和to只能輸入一個Only receiver or sender can be defined, not both
4096初始化使用者點數失敗Error initializing user's point (asset)
4097新增管理員點數失敗Error increasing admin points
4098新增使用者點數失敗Error transferring points
4100新增未簽名的交易提案失敗Error while creating transaction proposal
4104提交簽名的交易提案失敗Error while committing transaction proposal to the blockchain
4112傳送簽名的交易失敗Error while committing the transaction to the blockchain

v 1.2.4

Error code table, bug fixes

v 1.2.3

Account lock for a period of time - 登入錯誤, 鎖定中 AUTHENTICATION_ACCOUNT_LOCKED

v 1.2.2

Account password has expired and need to be reset - 密碼過期 AUTHENTICATION_ACCOUNT_PASSWORD_EXPIRED

v 1.2.1

Not enough points to pay the order PARAMETER_NOT_ENOUGH_POINTS

Can only define from or to, not both

PARAMETER_ONLY_ONE_ALLOWED

v 1.2.0

FILE_TO_BIG

File size is too big, 打案太大

v 1.1.9

Bug fixed

v 1.1.8

PARAMETER_CASH_OR_POINT

Error trading, order must be paid all in cash or all in points,只能選擇現金或點數交易

PARAMETER_CASH

Parameter cash is not enough to pay the order, 現金不足

SERVICE_FIREBASE

Error connecting to service,服務連結錯誤

BLOCKCHAIN_POINT_INITIALIZE

Error initializing user's point (asset),初始化使用者點數失敗

BLOCKCHAIN_POINT_INCREMENT

Error increasing admin points,初始化使用者點數失敗

BLOCKCHAIN_POINT_TRANSFER

Error transferring points,新增使用者點數失敗

BLOCKCHAIN_CREATE_TRANSACTION_PROPOSAL

Error while creating transaction proposal,新增未簽名的交易提案失敗

BLOCKCHAIN_COMMIT_TRANSACTION_PROPOSAL

Error while committing transaction proposal to the blockchain,提交簽名的交易提案失敗

BLOCKCHAIN_COMMIT_TRANSACTION

Error while committing the transaction to the blockchain,傳送簽名的交易失敗

v 1.1.7

Missing the success in Chinese - bug

v 1.1.6

Add languages: en ( English ) & cz ( Traditional Chinese, default )

v 1.1.5

DB_ERROR_WRONG_STATUS

The record is disabled, inactive or unknown status

v 1.1.4

UNKNOWN_FUNCTION_NAME

The function the API is trying to access is known to one of the services

v 1.1.3

TOKEN_ERROR_EXPIRED

JWT Token has expired

v 1.1.2

AUTHENTICATION_ALREADY_LOGIN

Users has already been login, a new token will not be returned until user logout first.

v 1.1.1

PARAMETER_INVALID

A parameter value is invalid. Ex: role is only expecting values ranging from 0 to 3 but the value received is 4, then the parameter value is invalid. Please note that if the value received is a different format then please use PARAMETER_UNSUPPORTED_FORMAT

AUTHENTICATION_USERNAME_IN_USED

A username has been already register

AUTHENTICATION_ACCESS_DENIED

Access to a resource has been denied either by providing the wrong credentials or the wrong token

SERVICE_CONNECTION_ERROR

A connection to a service has not been established or it has been broken.

SERVICE_CA_ERROR

The certificate authority is returning an error. The error details could be added to the object

v 1.1.0

DB_ERROR_NOT_FOUND

A record was expected to be returned but nothing was return. If returning empty from database is possible, like in list API, then this is not the error code to use.

v 1.0.9

PARAMETER_EMAIL_FORMAT

Parameter is expected to have an email format

PARAMETER_UNSUPPORTED_FORMAT

Parameter format is unknown or it is currently not supported

v 1.0.6

SUCCESS

Request has been successful

DB_ERROR_GET

Error while trying to get a record from the database

DB_ERROR_CREATE

Error while trying to create a record in the database

DB_ERROR_UPDATE

Error while trying to update a record in the database

PARAMETER_REQUIRED

Required parameter not received

PARAMETER_JSON_FORMAT

Error while trying to parse a json formatted variable

TOKEN_ERROR_INVALID

Token is not valid

FILE_NOT_UPLOADED

A file was not uploaded to the server

FILE_TYPE_NOT_SUPPORTED

The uploaded file's type is not supported

OS_MOVE_FILE

Error while moving the file to location

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago