TP-87179 | Add Raw Response in Clickstream (#13093)

This commit is contained in:
Prajjaval Verma
2024-10-16 15:47:41 +05:30
committed by GitHub
parent b96800245c
commit 37786187b0
3 changed files with 17 additions and 2 deletions

View File

@@ -25,4 +25,6 @@ data class ErrorMessage(
var appRequestId: String? = null,
var vertical: String? = null,
var cfRay: String? = null,
var rawResponse: String? = null,
var trace: String? = null,
) : Parcelable

View File

@@ -60,7 +60,8 @@ abstract class ResponseCallback {
description = it.message,
apiUrl = response.raw().request.url.toString(),
appRequestId = getRequestIdFromResponse(response),
vertical = getVerticalFromResponse(response)
vertical = getVerticalFromResponse(response),
rawResponse = response.raw().toString()
),
it.errors,
it.warning,
@@ -100,7 +101,8 @@ abstract class ResponseCallback {
description = response.message(),
apiUrl = response.raw().request.url.toString(),
appRequestId = getRequestIdFromResponse(response),
vertical = getVerticalFromResponse(response)
vertical = getVerticalFromResponse(response),
rawResponse = response.raw().toString()
),
errorResponse?.errors,
null,

View File

@@ -395,6 +395,7 @@ object CommonUtils {
appRequestId: String? = null,
vertical: String? = null,
cfRay: String? = null,
rawResponse: String? = null
): ErrorMessage {
val errorMessage = ErrorMessage()
when (statusCode) {
@@ -407,6 +408,10 @@ object CommonUtils {
AppServiceManager.application.getString(
R.string.check_internet_connectivity_and_try_again
)
errorMessage.trace =
(errorMessage.trace ?: "") +
AppServiceManager.application.getString(R.string.no_internet_connection) +
"_"
}
API_CODE_ERROR,
API_CODE_SOCKET_TIMEOUT,
@@ -416,10 +421,15 @@ object CommonUtils {
AppServiceManager.application.getString(R.string.something_went_wrong)
errorMessage.description =
AppServiceManager.application.getString(R.string.technical_issue)
errorMessage.trace =
(errorMessage.trace ?: "") +
AppServiceManager.application.getString(R.string.something_went_wrong) +
"_"
}
else -> {
errorMessage.message = message
errorMessage.description = description
errorMessage.trace = (errorMessage.trace ?: "") + message + "_"
}
}
errorMessage.statusCode = statusCode
@@ -427,6 +437,7 @@ object CommonUtils {
errorMessage.appRequestId = appRequestId
errorMessage.vertical = vertical
errorMessage.cfRay = cfRay
errorMessage.rawResponse = rawResponse
return errorMessage
}