mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor(Async): update onError of CompleteCallback interface (#149)
* refactor(Async): update onError of CompleteCallback interface Include the error that occurs. * refactor(Async): swap onError parameters
This commit is contained in:
@@ -56,7 +56,7 @@ public class Async {
|
|||||||
public interface CompleteCallback {
|
public interface CompleteCallback {
|
||||||
void onComplete(Object result, Object tag);
|
void onComplete(Object result, Object tag);
|
||||||
|
|
||||||
void onError(Object tag);
|
void onError(String error, Object tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class PriorityThreadFactory implements ThreadFactory {
|
static class PriorityThreadFactory implements ThreadFactory {
|
||||||
@@ -194,7 +194,7 @@ public class Async {
|
|||||||
if (result != null) {
|
if (result != null) {
|
||||||
this.callback.onComplete(result, this.context);
|
this.callback.onComplete(result, this.context);
|
||||||
} else {
|
} else {
|
||||||
this.callback.onError(this.context);
|
this.callback.onError("DownloadImageTask returns no result.", this.context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ public class Async {
|
|||||||
if (result != null) {
|
if (result != null) {
|
||||||
this.callback.onComplete(result, this.requestId);
|
this.callback.onComplete(result, this.requestId);
|
||||||
} else {
|
} else {
|
||||||
this.callback.onError(this.requestId);
|
this.callback.onError("LoadImageFromResourceTask returns no result.", this.requestId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,7 +250,7 @@ public class Async {
|
|||||||
if (result != null) {
|
if (result != null) {
|
||||||
this.callback.onComplete(result, this.requestId);
|
this.callback.onComplete(result, this.requestId);
|
||||||
} else {
|
} else {
|
||||||
this.callback.onError(this.requestId);
|
this.callback.onError("LoadImageFromFileTask returns no result.", this.requestId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -274,7 +274,7 @@ public class Async {
|
|||||||
if (result != null) {
|
if (result != null) {
|
||||||
this.callback.onComplete(result, this.requestId);
|
this.callback.onComplete(result, this.requestId);
|
||||||
} else {
|
} else {
|
||||||
this.callback.onError(this.requestId);
|
this.callback.onError("LoadImageFromBase64StringTask returns no result.", this.requestId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -572,7 +572,7 @@ public class Async {
|
|||||||
if (result != null) {
|
if (result != null) {
|
||||||
this.callback.onComplete(result, this.context);
|
this.callback.onComplete(result, this.context);
|
||||||
} else {
|
} else {
|
||||||
this.callback.onError(this.context);
|
this.callback.onError("HttpRequestTask returns no result.", this.context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user