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
fix: Add error utils, fix stripe error message and charge data class #2269
Conversation
mutableMessage.value = resource.getString(R.string.payment_not_complete_message) | ||
if (it is HttpException) { | ||
val body = it.response()?.errorBody() | ||
val jsonObject = JSONObject(body?.string()).getJSONArray(ERRORS)[0] |
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.
This will crash the app if not present
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.
So I think, try-catch can be used.
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.
Copy ErrorUtils from orga app and use getErrorDetails, so this can be handled once for everywhere
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.
Updated
1a8bc72
to
938cbc8
Compare
errorCode == FORBIDDEN || | ||
errorCode == NOT_FOUND || | ||
errorCode == METHOD_NOT_ALLOWED || | ||
errorCode == REQUEST_TIMEOUT) { |
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.
Is there any problem using Kotlin when expression for this here, I think it will look cleaner
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.
Sorry, can't get it?
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.
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.
updated
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.
Rest look good to me
83bba15
Part of #2133