mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add stringified payload to metametrics controller trackEvent error message (#11166)
* Add stringified payload to metametrics controller trackEvent error message * Don't include full payload when throwing error on missing event or category in trackEvent
This commit is contained in:
parent
a137cd1aca
commit
452a5e7de6
@ -330,7 +330,17 @@ export default class MetaMetricsController {
|
||||
async trackEvent(payload, options) {
|
||||
// event and category are required fields for all payloads
|
||||
if (!payload.event || !payload.category) {
|
||||
throw new Error('Must specify event and category.');
|
||||
throw new Error(
|
||||
`Must specify event and category. Event was: ${
|
||||
payload.event
|
||||
}. Category was: ${payload.category}. Payload keys were: ${Object.keys(
|
||||
payload,
|
||||
)}. ${
|
||||
typeof payload.properties === 'object'
|
||||
? `Payload property keys were: ${Object.keys(payload.properties)}`
|
||||
: ''
|
||||
}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (!this.state.participateInMetaMetrics && !options?.isOptIn) {
|
||||
|
Loading…
Reference in New Issue
Block a user