Skip to content
Snippets Groups Projects
Commit 3b0730d1 authored by Shane Tomlinson's avatar Shane Tomlinson
Browse files

Adding the jqXHR responseText as part of the XHR error information. Printing info in error screen.

parent bfea4a4e
No related branches found
No related tags found
No related merge requests found
......@@ -37,12 +37,17 @@
<strong>Response Code - </strong> <%= network.textStatus %>
</p>
<% if (network.responseText) { %>
<p>
<strong>Response Text:</strong> <%= network.responseText %>
</p>
<% } %>
<% if (network.errorThrown) { %>
<p>
<strong>Error Type:</strong> <%= network.errorThrown %>
</p>
<% } %>
</li>
<% } %>
......
......@@ -64,6 +64,7 @@ BrowserID.Network = (function() {
network.status = jqXHR && jqXHR.status;
network.textStatus = textStatus;
network.errorThrown = errorThrown;
network.responseText = jqXHR.responseText;
if (cb) cb(info);
mediator && mediator.publish("xhrError", info);
......
......@@ -166,7 +166,7 @@ BrowserID.Mocks.xhr = (function() {
else if (obj.error) {
// Invalid result - either invalid URL, invalid GET/POST or
// invalid resultType
obj.error({ status: result || 400 }, "errorStatus", "errorThrown");
obj.error({ status: result || 400, responseText: "response text" }, "errorStatus", "errorThrown");
}
}
};
......
......@@ -70,6 +70,7 @@
ok(info.network.type, "request type is in network info");
equal(info.network.textStatus, "errorStatus", "textStatus is in network info");
equal(info.network.errorThrown, "errorThrown", "errorThrown is in response info");
equal(info.network.responseText, "response text", "responseText is in response info");
wrappedStart();
mediator.unsubscribe(handle);
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment