Error Codes and Messages Explanation

Error codes and error messages are often use in api requests for signifying status. Here are the error codes, messages, and HTTP status code used by me in my applications. You may feel free to use them in your own projects.

Introduction

Error codes and error messages are often use in api requests for signifying status. Here are the error codes, messages, and HTTP status code used by me in my applications. You may feel free to use them in your own projects.

Codes and Messages

00000 All OK

{errorcode: 0, errmsg: ''} 200 All OK

10000 User Problem

{errorcode: 10000, errmsg: 'empty info'} 400 Bad Request
{errorcode: 10001, errmsg: 'Username Occupied'} 409 Conflict
{errorcode: 10002, errmsg: 'Email Occupied'} 409 Conflict
{errorcode: 10003, errmsg: 'Invalid username'} 400  Bad Request
{errorcode: 10004, errmsg: 'Invalid password'} 401 Unauthorized
{errorcode: 10005, errmsg: 'Invalid token'} 401 Unauthorized
{errorcode: 10006, errmsg: 'Invalid cookie'} 401 Unauthorized
{errorcode: 10007, errmsg: 'Invalid combination of info'} 401 Unauthorized

20000 Database Problem

{errorcode: 20000, errmsg: 'Fail to connect to database'} 503 Service Unavailable
{errorcode: 20001, errmsg: 'Fail to query info'} 503 Service Unavailable
{errorcode: 20002, errmsg: 'Fail to insert info'} 503 Service Unavailable
{errorcode: 20003, errmsg: 'Fail to update info'} 503 Service Unavailable
{errorcode: 20004, errmsg: 'Fail to delete info'} 503 Service Unavailable

70000 Server

{errcode: 70000, errmsg: 'Internal server error'}

Subscribe to TheXYZLab Blog

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe