-
-
Notifications
You must be signed in to change notification settings - Fork 50
Fix/improve error handling #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Included latest typings from `net.gotev.uploadservice` which shows a change in the signature of `onError` from: `onError(context: any, uploadInfo: UploadInfo, error) {}` to: `onError(context: Context, uploadInfo: UploadInfo, serverResponse: ServerResponse, error: java.lang.Exception) {}` Also, the `error` was also not being passed to the new `zonedOnError` function. Also added the responseCode in the `ErrorEventData` in a cross-platform matter to allow apps to respond accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DickSmith I think that it would be good to also add the responseCode
to the complete
event that is raised by onProgressReceiverCompleted
and URLSessionTaskDidCompleteWithError
.
Other than that I tested the PR and it looks good. Could you make the above changes after which I will proceed with merging and publishing the package.
Add type-checking to Error, Result, and Progress payloads. Convert tabs to spaces in `background-http.ios.ts` to be consistent with rest of repo
@VladimirAmiorkov |
Ah, I just reread your comment. What I was thinking of doing, Android is already returning the response object there, but iOS is not, do you still want the response returned there? or just the responseCode? |
Adding `responseCode` to CompleteEventData Breaking for Android: Android originally returned the response here (undocumented behaviour), while iOS did not, so now only the code will be returned
OK, so I added the responseCode to complete as well. Let me know your thoughts. |
Hi @DickSmith , I see what you mean about the I would suggest to either expose the native response on iOS also which is currently a missing functionality (two birds with one stone) or simply return the We appreciate your work on this. |
@VladimirAmiorkov I'll add a JSDoc to the Would be nice to unify those for sure, but yeah, I don't currently have the time to plow deeper on this one myself, and the |
@VladimirAmiorkov |
@DickSmith This is available with version 3.2.5 |
Included latest typings from
net.gotev.uploadservice
which shows a change in the signature ofonError
from:onError(context: any, uploadInfo: UploadInfo, error) {}
to:
onError(context: Context, uploadInfo: UploadInfo, serverResponse: ServerResponse, error: java.lang.Exception) {}
Also, the
error
was also not being passed to the newzonedOnError
function.Also added the responseCode in the
ErrorEventData
in a cross-platform matter to allow apps to respond accordingly.PR Checklist
What is the current behavior?
ServerResponse
is being passed as the error rather than thejava.lang.Exception
in the current method, but then isn't actually being passed tozonedOnError
, either.The response code is not available.
What is the new behavior?
The
Exception
is now being passed correctly as the error.The
responseCode
is now available for both iOS and Android, or-1
if the response is invalid.BREAKING CHANGES:
None, since currently the error isn't being passed up at all on Android, and the
responseCode
is a new property for both.