Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-104141

Support attaching error labels to arbitrary Statuses

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Server Programmability
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      Which error labels should be appended to an error response is primarily determined by the category of the error code, though a few labels are only appended depending on the outcome of some runtime checks that are based on operation state. All labels are determined when constructing the response to send to the user, however As a result, the error labels builder needs to be given lots of state about the operation in order to determine which labels to set.

      It would be more ergonomic and prevent possible future layering violations if sites that generated error statuses could set error labels themselves too. This is especially useful for conditionally applying error labels to existing error codes that can't be added to the broader category.

      e.g. this is the logic for determining if the ResumableChangeStream error label should be applied: https://github.com/10gen/mongo/blob/5a46b791972f54e58b1e6d79eb77e3735c392db1/src/mongo/db/error_labels.cpp#L138-L179

            Assignee:
            Unassigned Unassigned
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: