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({
|
com.koushikdutta.ion.Ion.with(context, url).asString().setCallback(new com.koushikdutta.async.future.FutureCallback({
|
||||||
onCompleted: function (e, result) {
|
onCompleted: function (e, result) {
|
||||||
if (e && errorCallback) {
|
if (e && errorCallback) {
|
||||||
errorCallback(e.toString());
|
errorCallback(new Error(e.toString()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
successCallback(result);
|
successCallback(result);
|
||||||
@ -55,7 +55,7 @@ export module tk {
|
|||||||
com.koushikdutta.ion.Ion.with(context, url).asBitmap().setCallback(new com.koushikdutta.async.future.FutureCallback({
|
com.koushikdutta.ion.Ion.with(context, url).asBitmap().setCallback(new com.koushikdutta.async.future.FutureCallback({
|
||||||
onCompleted: function (e, result) {
|
onCompleted: function (e, result) {
|
||||||
if (e && errorCallback) {
|
if (e && errorCallback) {
|
||||||
errorCallback(e.toString());
|
errorCallback(new Error(e.toString()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ export module tk {
|
|||||||
var dataTask = session.dataTaskWithURLCompletionHandler(Foundation.NSURL.URLWithString(url), function (data, response, error) {
|
var dataTask = session.dataTaskWithURLCompletionHandler(Foundation.NSURL.URLWithString(url), function (data, response, error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
if (errorCallback) {
|
if (errorCallback) {
|
||||||
errorCallback(error.description);
|
errorCallback(new Error(error.localizedDescription()));
|
||||||
}
|
}
|
||||||
} else if (successCallback) {
|
} else if (successCallback) {
|
||||||
successCallback(data);
|
successCallback(data);
|
||||||
|
Reference in New Issue
Block a user