Closed Bug 1711848 Opened 5 years ago Closed 5 years ago

Add argument separation comments for QM_OR_ELSE(WARN|NOTE|LOG_VERBOSE)(_IF) uses

Categories

(Core :: Storage: Quota Manager, task, P2)

task

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: janv, Assigned: janv)

Details

Attachments

(1 file)

The complex uses of QM_TRY and QM_OR_ELSE are sometimes hard to read. Argument separation using comments should help with better readability.

Example:

QM_TRY(QM_OR_ELSE_WARN_IF(
    // Expression
    ToResult(InitializeOrigin(
        aPersistenceType, metadata,
        metadata.mLastAccessTime, metadata.mPersisted,
        childDirectory)),
    // Predicate
    IsDatabaseCorruptionError,
    // Fallback
    ([&childDirectory](
         const nsresult rv) -> Result<Ok, nsresult> {
      // If the origin can't be initialized due to
      // corruption, this is a permanent
      // condition, and we need to remove all data
      // for the origin on disk.

      QM_TRY(childDirectory->Remove(true));

      return Ok{};
    })));
Pushed by jvarga@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5688acd04fa5 Add argument separation comments for QM_OR_ELSE(WARN|NOTE|LOG_VERBOSE)(_IF) uses; r=dom-storage-reviewers,jstutte
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: