Skip to content

Commit 8fbf208

Browse files
committed
Merge pull request #11 from slamdata/onerror-handler
Better handler for XHR onerror
2 parents 7ccbfe5 + a0ecc7c commit 8fbf208

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Network/HTTP/Affjax.purs

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

test/Main.purs

+3
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)