caught-object-report-json
Advanced tools
Comparing version
20
index.js
@@ -256,6 +256,4 @@ "use strict"; | ||
case exports.CORJ_AS_STRING_FORMAT_TO_CORJ_AS_STRING_METHOD: { | ||
if (!caught || | ||
typeof caught !== 'object' || | ||
!('toCorjAsString' in caught) || | ||
typeof caught['toCorjAsString'] !== 'function') { | ||
var r = safeAccessProp(nestedCfg, 'as_string', options, 'caught', caught, 'toCorjAsString'); | ||
if (!('value' in r) || typeof r.value !== 'function') { | ||
if (i < formats.length - 1) { | ||
@@ -272,3 +270,3 @@ continue; | ||
else { | ||
var value = caught.toCorjAsString({ options: options, caught: caught, nestedCfg: nestedCfg }); | ||
var value = r.value.call(caught, { options: options, caught: caught, nestedCfg: nestedCfg }); | ||
if (typeof value !== 'string') { | ||
@@ -359,6 +357,4 @@ if (i < formats.length - 1) { | ||
case exports.CORJ_AS_JSON_FORMAT_TO_CORJ_AS_JSON_METHOD: { | ||
if (!caught || | ||
typeof caught !== 'object' || | ||
!('toCorjAsJson' in caught) || | ||
typeof caught['toCorjAsJson'] !== 'function') { | ||
var r = safeAccessProp(nestedCfg, 'as_string', options, 'caught', caught, 'toCorjAsJson'); | ||
if (!('value' in r) || typeof r.value !== 'function') { | ||
if (i < formats.length - 1) { | ||
@@ -375,4 +371,4 @@ continue; | ||
else { | ||
var value = jsonStringify(caught.toCorjAsJson({ options: options, caught: caught, nestedCfg: nestedCfg })); | ||
if (value === undefined) { | ||
var stringValue = jsonStringify(r.value.call(caught, { options: options, caught: caught, nestedCfg: nestedCfg })); | ||
if (typeof stringValue !== 'string') { | ||
if (i < formats.length - 1) { | ||
@@ -391,3 +387,3 @@ continue; | ||
format: format, | ||
value: JSON.parse(value) | ||
value: JSON.parse(stringValue) | ||
}; | ||
@@ -394,0 +390,0 @@ } |
{ | ||
"name": "caught-object-report-json", | ||
"version": "7.1.0", | ||
"version": "7.1.1", | ||
"description": "JS Error JSON representation", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
84806
-0.04%1072
-0.37%