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
3cbef734f2
commit
1323a77531
@ -330,7 +330,17 @@ export default class MetaMetricsController {
|
|||||||
async trackEvent(payload, options) {
|
async trackEvent(payload, options) {
|
||||||
// event and category are required fields for all payloads
|
// event and category are required fields for all payloads
|
||||||
if (!payload.event || !payload.category) {
|
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) {
|
if (!this.state.participateInMetaMetrics && !options?.isOptIn) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user