Skip to content

Commit

Permalink
MONEYMONG-511 feature: ResultCallAdapter 에서 예상치 못한 에러 스펙일 때를 대비해서 try…
Browse files Browse the repository at this point in the history
… catch 추가
  • Loading branch information
jhg3410 committed Oct 22, 2024
1 parent 9efe6de commit 5b22f18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ private class ResultCall<T>(
return Result.failure(MoneyMongError.UnExpectedError)
}

val errorResponse = fromJsonToErrorResponse(errorBody)
val httpError = getErrorByStatusCode(
statusCode = errorResponse.status,
message = errorResponse.message
)
return Result.failure(httpError)
return try {
val errorResponse = fromJsonToErrorResponse(errorBody)
val httpError = getErrorByStatusCode(
statusCode = errorResponse.status,
message = errorResponse.message
)
Result.failure(httpError)
} catch (e: Exception) {
Result.failure(MoneyMongError.UnExpectedError)
}
}

override fun onFailure(call: Call<T>, t: Throwable) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.moneymong.moneymong.network.response

import com.google.gson.Gson
import com.google.gson.annotations.SerializedName

data class ErrorResponse(
val status: Int,
Expand Down

0 comments on commit 5b22f18

Please sign in to comment.