Previous Topic: Error Handling Technique SelectionNext Topic: Security


Standardize Error Codes

In several of the error handling techniques, an error code is used to communicate the server error to the client. This error code is directly related to exit states.

Maintaining this relationship is an important consideration to the assignment and management of the error codes. You should establish a naming convention for both exit states and error codes to enable this association.

An effective approach is to develop a code that will prefix all exit state names and represent the error code for that exit state.

The following table provides examples of a five-character code:

Exit State

Error Code

AA001_Customer_Not_Found

AA001

AA002_Customer_Add_Not_Successful

AA002

AA003_Customer_Type_Invalid

AA003

In this example, the error code is made up of two parts: