fast-azure-storage
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -472,22 +472,33 @@ 'use strict'; | ||
// Parse payload | ||
var xml = libxml.parseXml(res.payload); | ||
// Parse payload for error message and code | ||
var message, code; | ||
try { | ||
var xml = libxml.parseXml(res.payload); | ||
// Find error message | ||
var message = xml.get('/Error/Message'); | ||
if (message) { | ||
message = message.text(); | ||
} else { | ||
message = "No error message given, in payload '" + res.payload + "'"; | ||
// Find error message | ||
message = xml.get('/Error/Message'); | ||
if (message) { | ||
message = message.text(); | ||
} | ||
// Find error code | ||
code = xml.get('/Error/Code'); | ||
if (code) { | ||
code = code.text(); | ||
} | ||
} catch (e) { | ||
// Ignore parsing errors | ||
} | ||
// Find error code | ||
var code = xml.get('/Error/Code'); | ||
if (code) { | ||
code = code.text(); | ||
} else if (500 <= res.statusCode && res.statusCode < 600) { | ||
code = 'InternalErrorWithoutCode'; | ||
} else { | ||
code = 'ErrorWithoutCode'; | ||
// Find default message and code | ||
if (!message) { | ||
message = "No error message given, in payload '" + res.payload + "'"; | ||
} | ||
if (!code) { | ||
if (500 <= res.statusCode && res.statusCode < 600) { | ||
code = 'InternalErrorWithoutCode'; | ||
} else { | ||
code = 'ErrorWithoutCode'; | ||
} | ||
} | ||
@@ -494,0 +505,0 @@ // Construct error object |
{ | ||
"name": "fast-azure-storage", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"author": "Jonas Finnemann Jensen <jopsen@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "Fast client library for azure storage services", |
@@ -73,2 +73,11 @@ suite("Queue", function() { | ||
test("getMetadata (from non-existent queue)", function() { | ||
return queue.getMetadata(queueName + '-missing').then(function() { | ||
assert(false, "Expected an error here"); | ||
}, function(err) { | ||
// Bug in azure API means that we don't get an error code here | ||
assert(err.statusCode === 404, "Expected 404"); | ||
}); | ||
}); | ||
test("setMetadata", function() { | ||
@@ -75,0 +84,0 @@ // Don't actually want to change the meta-data as it would affect the |
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
1451134
3752