@elastic/apm-rum-core
Advanced tools
Comparing version 5.19.0 to 5.20.0
@@ -11,2 +11,3 @@ var _excluded = ["tags"]; | ||
var IGNORE_KEYS = ['stack', 'message']; | ||
var PROMISE_REJECTION_PREFIX = 'Unhandled promise rejection: '; | ||
@@ -144,3 +145,2 @@ function getErrorProperties(error) { | ||
_proto.logPromiseEvent = function logPromiseEvent(promiseRejectionEvent) { | ||
var prefix = 'Unhandled promise rejection: '; | ||
var reason = promiseRejectionEvent.reason; | ||
@@ -158,9 +158,6 @@ | ||
error: reason, | ||
message: prefix + name + reason.message | ||
message: PROMISE_REJECTION_PREFIX + name + reason.message | ||
}; | ||
} else { | ||
reason = typeof reason === 'object' ? '<object>' : typeof reason === 'function' ? '<function>' : reason; | ||
errorEvent = { | ||
message: prefix + reason | ||
}; | ||
errorEvent = this._parseRejectReason(reason); | ||
} | ||
@@ -183,2 +180,25 @@ | ||
_proto._parseRejectReason = function _parseRejectReason(reason) { | ||
var errorEvent = { | ||
message: PROMISE_REJECTION_PREFIX | ||
}; | ||
if (Array.isArray(reason)) { | ||
errorEvent.message += '<object>'; | ||
} else if (typeof reason === 'object') { | ||
try { | ||
errorEvent.message += JSON.stringify(reason); | ||
errorEvent.error = reason; | ||
} catch (error) { | ||
errorEvent.message += '<object>'; | ||
} | ||
} else if (typeof reason === 'function') { | ||
errorEvent.message += '<function>'; | ||
} else { | ||
errorEvent.message += reason; | ||
} | ||
return errorEvent; | ||
}; | ||
return ErrorLogging; | ||
@@ -185,0 +205,0 @@ }(); |
@@ -11,2 +11,6 @@ import { PERF, isPerfTimelineSupported, isRedirectInfoAvailable } from '../../common/utils'; | ||
if (!transaction.captureTimings) { | ||
if (transaction.type === PAGE_LOAD) { | ||
transaction._start = 0; | ||
} | ||
return; | ||
@@ -13,0 +17,0 @@ } |
@@ -23,2 +23,3 @@ "use strict"; | ||
var IGNORE_KEYS = ['stack', 'message']; | ||
var PROMISE_REJECTION_PREFIX = 'Unhandled promise rejection: '; | ||
@@ -156,3 +157,2 @@ function getErrorProperties(error) { | ||
_proto.logPromiseEvent = function logPromiseEvent(promiseRejectionEvent) { | ||
var prefix = 'Unhandled promise rejection: '; | ||
var reason = promiseRejectionEvent.reason; | ||
@@ -170,9 +170,6 @@ | ||
error: reason, | ||
message: prefix + name + reason.message | ||
message: PROMISE_REJECTION_PREFIX + name + reason.message | ||
}; | ||
} else { | ||
reason = typeof reason === 'object' ? '<object>' : typeof reason === 'function' ? '<function>' : reason; | ||
errorEvent = { | ||
message: prefix + reason | ||
}; | ||
errorEvent = this._parseRejectReason(reason); | ||
} | ||
@@ -195,2 +192,25 @@ | ||
_proto._parseRejectReason = function _parseRejectReason(reason) { | ||
var errorEvent = { | ||
message: PROMISE_REJECTION_PREFIX | ||
}; | ||
if (Array.isArray(reason)) { | ||
errorEvent.message += '<object>'; | ||
} else if (typeof reason === 'object') { | ||
try { | ||
errorEvent.message += JSON.stringify(reason); | ||
errorEvent.error = reason; | ||
} catch (error) { | ||
errorEvent.message += '<object>'; | ||
} | ||
} else if (typeof reason === 'function') { | ||
errorEvent.message += '<function>'; | ||
} else { | ||
errorEvent.message += reason; | ||
} | ||
return errorEvent; | ||
}; | ||
return ErrorLogging; | ||
@@ -197,0 +217,0 @@ }(); |
@@ -30,2 +30,6 @@ "use strict"; | ||
if (!transaction.captureTimings) { | ||
if (transaction.type === _constants.PAGE_LOAD) { | ||
transaction._start = 0; | ||
} | ||
return; | ||
@@ -32,0 +36,0 @@ } |
{ | ||
"name": "@elastic/apm-rum-core", | ||
"version": "5.19.0", | ||
"version": "5.20.0", | ||
"description": "Elastic apm core", | ||
@@ -46,3 +46,3 @@ "license": "MIT", | ||
], | ||
"gitHead": "05d6195c449afb3676ed80d98c03cdeda4e03ec7" | ||
"gitHead": "b9a7e5def7baa79a72906ba4345d0613bd25e63a" | ||
} |
@@ -36,2 +36,3 @@ /** | ||
const IGNORE_KEYS = ['stack', 'message'] | ||
const PROMISE_REJECTION_PREFIX = 'Unhandled promise rejection: ' | ||
@@ -176,3 +177,2 @@ function getErrorProperties(error) { | ||
logPromiseEvent(promiseRejectionEvent) { | ||
const prefix = 'Unhandled promise rejection: ' | ||
let { reason } = promiseRejectionEvent | ||
@@ -191,14 +191,6 @@ if (reason == null) { | ||
error: reason, | ||
message: prefix + name + reason.message | ||
message: PROMISE_REJECTION_PREFIX + name + reason.message | ||
} | ||
} else { | ||
reason = | ||
typeof reason === 'object' | ||
? '<object>' | ||
: typeof reason === 'function' | ||
? '<function>' | ||
: reason | ||
errorEvent = { | ||
message: prefix + reason | ||
} | ||
errorEvent = this._parseRejectReason(reason) | ||
} | ||
@@ -217,4 +209,30 @@ this.logErrorEvent(errorEvent) | ||
} | ||
_parseRejectReason(reason) { | ||
const errorEvent = { | ||
message: PROMISE_REJECTION_PREFIX | ||
} | ||
if (Array.isArray(reason)) { | ||
errorEvent.message += '<object>' | ||
} else if (typeof reason === 'object') { | ||
try { | ||
errorEvent.message += JSON.stringify(reason) | ||
errorEvent.error = reason | ||
} catch (error) { | ||
// fallback. JSON.stringify can throw exceptions in different circumstances. | ||
// please, see this link for more info: | ||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#exceptions | ||
errorEvent.message += '<object>' | ||
} | ||
} else if (typeof reason === 'function') { | ||
errorEvent.message += '<function>' | ||
} else { | ||
errorEvent.message += reason | ||
} | ||
return errorEvent | ||
} | ||
} | ||
export default ErrorLogging |
@@ -45,2 +45,10 @@ /** | ||
if (!transaction.captureTimings) { | ||
/** | ||
* Make sure page load transactions always starts at 0 irrespective if we capture navigation metrics or not | ||
* otherwise we would be reporting different page load durations for sampled and unsampled transactions | ||
*/ | ||
if (transaction.type === PAGE_LOAD) { | ||
transaction._start = 0 | ||
} | ||
return | ||
@@ -47,0 +55,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
510523
15289