Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Error groups and error codes
First proposed abstraction is a concept of error groups. It is similar to what was called an ErrorScope in Devlist Discussion.
The main idea is that all errors in Ignite will be grouped. The way to identify an error type is to have a pair - (group; code), where code represents an integer number, unique within a group.
For example, (TABLE, 1) and (SQL, 1) are both valid errors despite the apparent collision.
Each group defines a collection of errors that belong to a single component/module/vendor. For example, RAFT, TABLE or SQL. It is convenient to have an integer code for groups as well, so that users won’t have to compare strings in their code. Hence each group must be identified by a unique name and code. See class ErrorGroup for the reference. Uniqueness must be guaranteed by a newGroup method, which is a single point to create new error groups.
So, each error type could be represented in two different ways - as a human-readable string and as an integer number. First is used exclusively in text - logs and error messages. Second - exclusively in code:
Name should be formatted like this: IGN-XXX-nnn, where XXX is a group name and nnn is an unique error code within a group. Additional IGN prefix will simplify googling the error.
Number code should be calculated using following code fragment:
(groupCode <<< 16) | (0xFFFF & errorCode).
This restricts all group codes and individual error codes to 16 bits only, which is still more than enough.
So, numeric error code includes both group code and an internal unique code. These codes should be stored in constants and be documented.
Attachments
Issue Links
- is blocked by
-
IGNITE-16985 Design table management flow (part 1)
- Resolved
- relates to
-
IGNITE-17312 Thin 3.0: Unified exception handling
- Resolved
- links to