Skip to content

Commit d16642a

Browse files
committed
Catch all exceptions in IterableRequest
OkHttp bundled with some Android versions has bugs that result in exceptions. We need to catch these so they can't crash the app.
1 parent 2129624 commit d16642a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

iterableapi/src/main/java/com/iterable/iterableapi/IterableRequest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ protected String doInBackground(IterableApiRequest... params) {
189189
} catch (IOException e) {
190190
logError(baseUrl, e);
191191
handleFailure(e.getMessage(), null);
192+
} catch (ArrayIndexOutOfBoundsException e) {
193+
// This exception is sometimes thrown from the inside of HttpUrlConnection/OkHttp
194+
logError(baseUrl, e);
195+
handleFailure(e.getMessage(), null);
196+
} catch (Exception e) {
197+
logError(baseUrl, e);
198+
handleFailure(e.getMessage(), null);
192199
} finally {
193200
if (urlConnection != null) {
194201
urlConnection.disconnect();

0 commit comments

Comments
 (0)