Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-14931

Define common error scopes and prefix

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-beta1
    • 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

          Activity

            People

              slava.koptilin Vyacheslav Koptilin
              slava.koptilin Vyacheslav Koptilin
              Ivan Bessonov Ivan Bessonov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m