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

Convert invariants on Status.isOK() to invariants on the Status itself

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Service Arch
    • Fully Compatible
    • ALL
    • v8.0
    • Programmability 2024-06-24, Programmability 2024-07-08, Programmability 2024-07-22

      We still have some places in the codebase where we invariant on a Status object being OK rather than on the Status itself. Invarianting on the Status itself retains the semantics of failing when it's not OK but adds useful diagnostics in the output, like the error code originally causing the issue.

      Convert all invariants that look like invariant(status.isOK()); to invariant(status);. Additionally, write a clang-tidy check to enforce the convention of invarianting on the status directly (might be useful to do this first to find all the offending lines).

            Assignee:
            alex.li@mongodb.com Alex Li
            Reporter:
            james.bronsted@mongodb.com James Bronsted
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: