Skip to content

Commit 781af8e

Browse files
author
Morten Brix Pedersen
committed
Don't throw RuntimeException, but call onFailure for retry ability. Closes #1
1 parent 99c319b commit 781af8e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

library/src/main/java/com/queue_it/androidsdk/QueueService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public void run() {
108108
return;
109109
}
110110

111-
String body = response.body().string();
111+
final String body = response.body().string();
112112

113113
try {
114114

@@ -125,7 +125,12 @@ public void run() {
125125
}
126126
});
127127
} catch (JSONException e) {
128-
throw new RuntimeException(e);
128+
mainHandler.post(new Runnable() {
129+
@Override
130+
public void run() {
131+
_queueServiceListener.onFailure("Server did not return valid JSON: " + body, 0);
132+
}
133+
});
129134
}
130135
}
131136
});

0 commit comments

Comments
 (0)