1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 09:49:19 +02:00

better error message

This commit is contained in:
Nikolay Pultsin 2011-10-09 21:00:00 +01:00
parent 80a135d85f
commit bf781b2600
2 changed files with 6 additions and 5 deletions

View file

@ -1,4 +1,3 @@
better error message (UnknownHostException)
always sign in after registration
auto-sign-in
resources synchronization

View file

@ -212,12 +212,13 @@ public class ZLNetworkManager {
throw e;
} catch (IOException e) {
e.printStackTrace();
final String[] eName = e.getClass().getName().split("\\.");
if (eName.length > 0) {
throw new ZLNetworkException(true, eName[eName.length - 1] + ": " + e.getMessage(), e);
final String code;
if (e instanceof UnknownHostException) {
code = ZLNetworkException.ERROR_RESOLVE_HOST;
} else {
throw new ZLNetworkException(true, e.getMessage(), e);
code = ZLNetworkException.ERROR_CONNECT_TO_HOST;
}
throw new ZLNetworkException(code, ZLNetworkUtil.hostFromUrl(request.URL), e);
} finally {
request.doAfter(success);
if (httpClient != null) {
@ -246,6 +247,7 @@ public class ZLNetworkManager {
try {
perform(r);
} catch (ZLNetworkException e) {
e.printStackTrace();
errors.add(e.getMessage());
}
}