more web client exception handling improvements

This commit is contained in:
Vladimir Enchev
2014-03-24 09:58:27 +02:00
parent a227bbc171
commit d5a91269f6
2 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ export module tk {
com.koushikdutta.ion.Ion.with(context, url).asString().setCallback(new com.koushikdutta.async.future.FutureCallback({
onCompleted: function (e, result) {
if (e && errorCallback) {
errorCallback(e.toString());
errorCallback(new Error(e.toString()));
return;
}
successCallback(result);
@ -55,7 +55,7 @@ export module tk {
com.koushikdutta.ion.Ion.with(context, url).asBitmap().setCallback(new com.koushikdutta.async.future.FutureCallback({
onCompleted: function (e, result) {
if (e && errorCallback) {
errorCallback(e.toString());
errorCallback(new Error(e.toString()));
return;
}

View File

@ -55,7 +55,7 @@ export module tk {
var dataTask = session.dataTaskWithURLCompletionHandler(Foundation.NSURL.URLWithString(url), function (data, response, error) {
if (error) {
if (errorCallback) {
errorCallback(error.description);
errorCallback(new Error(error.localizedDescription()));
}
} else if (successCallback) {
successCallback(data);