fast-azure-storage
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -472,4 +472,3 @@ 'use strict'; | ||
message = details.message.value || details.message; | ||
} | ||
catch (e) { | ||
} catch (e) { | ||
// Ignore parse and extraction errors | ||
@@ -529,3 +528,3 @@ } | ||
} | ||
var payload = JSON.parse(res.payload); | ||
var payload = utils.parseJSON(res.payload); | ||
return { | ||
@@ -723,3 +722,3 @@ tables: payload.value.map(function(table) { | ||
} | ||
return JSON.parse(res.payload); | ||
return utils.parseJSON(res.payload); | ||
}); | ||
@@ -793,3 +792,3 @@ }; | ||
// Read results from response | ||
var result = JSON.parse(res.payload); | ||
var result = utils.parseJSON(res.payload); | ||
var nextPartitionKey = res.headers['x-ms-continuation-nextpartitionkey']; | ||
@@ -796,0 +795,0 @@ var nextRowKey = res.headers['x-ms-continuation-nextrowkey']; |
@@ -170,1 +170,20 @@ 'use strict'; | ||
/* | ||
* Parse JSON exactly like `JSON.parse(data)`, but wrap the error so that the | ||
* invalid JSON data is attached to the error as a property. | ||
* | ||
* @param {string} data - String data to parse as JSON | ||
* @returns {object} Resulting JSON object | ||
*/ | ||
var parseJSON = function parseJSON(data) { | ||
try { | ||
return JSON.parse(data); | ||
} catch (err) { | ||
var e = new Error('Failed to parse JSON payload: ' + err.message); | ||
e.payload = data; | ||
throw e; | ||
} | ||
} | ||
// Export parseJSON | ||
exports.parseJSON = parseJSON; |
{ | ||
"name": "fast-azure-storage", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"author": "Jonas Finnemann Jensen <jopsen@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "Fast client library for azure storage services", |
Sorry, the diff of this file is not supported yet
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
106299
2270