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:
Vasil Chimev
2018-12-12 12:48:29 +02:00
committed by GitHub
parent 69da095789
commit a307295d6f

View File

@@ -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);
} }
} }