Closed Bug 1445814 Opened 2 years ago Closed 2 years ago

Each error should only cause Log.error to be called once

Categories

(Firefox :: Normandy Client, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
Firefox 61
Tracking Status
firefox61 --- fixed

People

(Reporter: mythmon, Assigned: mythmon)

References

Details

Attachments

(1 file)

Thanks to the trial of browser error collection, I've learned some things about how errors are reported. For example, log that happens with level > Log.warn (for example, Log.error), gets automatically passed along to Cu.reportError (and then on to Sentry). Further, repeated calls to Cu.reportError cannot be (easily) correlated.

Because of this, we should only call log.error once per error we detect. For example, here is a case of where we do not follow this rule:

    try {
      const result = await FilterExpressions.eval(recipe.filter_expression, context);
      return !!result;
    } catch (err) {
      log.error(`Error checking filter for "${recipe.name}"`);
      log.error(`Filter: "${recipe.filter_expression}"`);
      log.error(`Error: "${err}"`);
      return false;
    }

Further, we should think carefully about our use of log.error, keeping in mind that it triggers Cu.reportError.

[0]: https://wiki.mozilla.org/Firefox/BrowserErrorCollection
Assignee: nobody → mcooper
Status: NEW → ASSIGNED
Attachment #8959028 - Flags: review?(gijskruitbosch+bugs)
Comment on attachment 8959028 [details]
Bug 1445814 - Only call log.error and Cu.reportError once per error

https://reviewboard.mozilla.org/r/227898/#review233854
Attachment #8959028 - Flags: review?(gijskruitbosch+bugs) → review+
Pushed by mcooper@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/52612b2979b1
Only call log.error and Cu.reportError once per error r=Gijs
https://hg.mozilla.org/mozilla-central/rev/52612b2979b1
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 61
You need to log in before you can comment on or make changes to this bug.