Skip to content

Commit a0ecc7c

Browse files
committed
Include method and URL in XHR onerror
1 parent 62eb5c4 commit a0ecc7c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Network/HTTP/Affjax.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ foreign import unsafeAjax
161161
}
162162
}
163163
xhr.onerror = function (err) {
164-
errback(new Error("AJAX request failed"))();
164+
errback(new Error("AJAX request failed: " + options.method + " " + options.url))();
165165
};
166166
xhr.onload = function () {
167167
callback({

test/Main.purs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ main = launchAff $ do
3434

3535
res <- attempt $ get "/arrayview"
3636
liftEff $ either traceAny (traceAny :: AffjaxResponse Foreign -> _) res
37+
38+
res <- attempt $ get "ttp://www.google.com"
39+
liftEff $ either traceAny (traceAny :: AffjaxResponse Foreign -> _) res

0 commit comments

Comments
 (0)