@dynatrace/react-native-plugin
Version:
This plugin gives you the ability to use the Dynatrace Mobile agent in your react native application.
27 lines (26 loc) • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const SendEventValidation_1 = require("./modifier/SendEventValidation");
const EventModifierUtil_1 = require("./modifier/EventModifierUtil");
const EventCreator_1 = require("./EventCreator");
class ExceptionEventData {
constructor(error) {
this.rawEventProperties = {};
this.error = error;
}
addEventProperty(key, value) {
this.rawEventProperties[key] = value;
return this;
}
toJSON() {
const sanitizedEventProperties = SendEventValidation_1.SendEventValidation.modifyEvent(Object.assign({}, this.rawEventProperties));
if (sanitizedEventProperties === null) {
return null;
}
const exceptionEvent = Object.assign(Object.assign({}, (0, EventCreator_1.createErrorEvent)(this.error.name, this.error.message, this.error.stack)), sanitizedEventProperties);
(0, EventModifierUtil_1.flagEventProperties)(exceptionEvent);
(0, EventModifierUtil_1.addIsApiReported)(exceptionEvent);
return exceptionEvent;
}
}
exports.default = ExceptionEventData;