Closed Bug 1919834 Opened 2 years ago Closed 2 years ago

GleanEvent.record(null) throws

Categories

(Toolkit :: Telemetry, defect, P1)

defect

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: florian, Assigned: chutten)

Details

Attachments

(1 external file)

I was told instrumentation methods are supposed to never throw, but I noticed today that passing null to an event's record method throws ("Uncaught TypeError: GleanEvent.record: Argument 1 is not an object.")
Passing undefined or an actual object works, but this might be one of the reasons to have a try/catch block around the Glean calls.

Might be able to solve this by just adding ? to the record function making aExtra nullable in addition to optional.

Assignee: nobody → chutten
Severity: -- → N/A
Status: NEW → ASSIGNED
Component: Glean Metric Types → Telemetry
Priority: -- → P1
Product: Data Platform and Tools → Toolkit

Update: having difficulty with the combination of the param being both optional and nullable (hitting an assert inside mozilla::Maybe). Might be solvable, might not be.

Treat it like undefined and empty records: like nothing was passed at all.

The severity field is not set for this bug.
:chutten, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(chutten)
Severity: N/A → S4
Flags: needinfo?(chutten)
Pushed by chutten@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/19efc3341ed5 Accept null via the FOG event JS record API r=TravisLong,webidl,saschanaz
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: