RUMM-2796 RequestFactory can throw exceptions#1214
Conversation
3659546 to
3da65f5
Compare
0xnm
left a comment
There was a problem hiding this comment.
I've left few suggestion, but overall lgtm.
| internal enum class UploadStatus(val shouldRetry: Boolean) { | ||
| SUCCESS(shouldRetry = false), | ||
| NETWORK_ERROR(shouldRetry = true), | ||
| INVALID_REQUEST_ERROR(shouldRetry = false), |
There was a problem hiding this comment.
I would suggest something like REQUEST_CREATION_ERROR, because INVALID_REQUEST_ERROR may have a meaning that request was sent, but was rejected by the server (code 400, which is currently backed by HTTP_CLIENT_ERROR).
|
|
||
| @Test | ||
| fun `M return InvalidRequestError W upload() { request factory throws }`( | ||
| @Forgery fakeException: java.lang.Exception, |
There was a problem hiding this comment.
| @Forgery fakeException: java.lang.Exception, | |
| @Forgery fakeException: Exception, |
|
|
||
| @Test | ||
| fun `M log the exception to telemetry W upload() { request factory throws }`( | ||
| @Forgery fakeException: java.lang.Exception, |
There was a problem hiding this comment.
| @Forgery fakeException: java.lang.Exception, | |
| @Forgery fakeException: Exception, |
3da65f5 to
82208f3
Compare
82208f3 to
b31891b
Compare
Codecov Report
@@ Coverage Diff @@
## feature/sdkv2 #1214 +/- ##
=================================================
+ Coverage 82.65% 82.69% +0.04%
=================================================
Files 353 353
Lines 12537 12545 +8
Branches 2075 2073 -2
=================================================
+ Hits 10362 10374 +12
+ Misses 1537 1535 -2
+ Partials 638 636 -2
|
| val request = requestFactory.create(context, batch, batchMeta) | ||
| val request = try { | ||
| requestFactory.create(context, batch, batchMeta) | ||
| } catch (e: Exception) { |
There was a problem hiding this comment.
DO we have more information on what type of exception can happen? Or is this just hypothetical?
There was a problem hiding this comment.
unfortunately we don't. For example in case of SR it can be because of a bad payload format but in other cases it may be something else. I followed what iOS is doing also and I saw they also have it generic.
What does this PR do?
A brief description of the change being made with this pull request.
Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)