mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
more web client exception handling improvements
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user