-
Notifications
You must be signed in to change notification settings - Fork 2
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] errorcode 추출 방법 수정 #69
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f7f5200
[CHORE/#64] 줄바꿈
chattymin b24e92f
[CHORE/#64] 밑줄 제거
chattymin 8305a4d
[CHORE/#64] error code 파싱 함수 구현
chattymin 3c90e6e
[CHORE/#64] 화면 분기처리 수정
chattymin 78b5dfa
[CHORE/#64] 인터셉터 최종 수정
chattymin 5d83053
[CHORE/#64] TendencyTestSplashActivity 이동 처리
chattymin 3f5c1df
[CHORE/#64] StringExt 분리
chattymin b4058d0
[REFACTOR/#64] AuthInterceptor data 모듈로 이전
chattymin fa004bb
Merge branch 'develop' into fix/#64-errorcode-extraction
chattymin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 6 additions & 8 deletions
14
presentation/src/main/java/com/going/presentation/util/JsonExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
package com.going.presentation.util | ||
|
||
import android.util.Log | ||
import org.json.JSONObject | ||
import retrofit2.HttpException | ||
|
||
fun toErrorCode(throwable: Throwable): String = if (throwable is HttpException) { | ||
val jsonTemp = throwable.response()?.errorBody()?.byteString().toString() | ||
Log.e("TAG", "toErrorCode: $jsonTemp", ) | ||
val json = jsonTemp.slice(6 until jsonTemp.length - 2) + "}" | ||
Log.e("TAG", "toErrorCode: $json", ) | ||
JSONObject(json).getString("code") | ||
val codeIndex = jsonTemp.indexOf("code") | ||
var errorCode = jsonTemp.slice(codeIndex + 7..codeIndex + 12) | ||
|
||
if (errorCode.endsWith('\"')) errorCode = errorCode.slice(0 until errorCode.length - 1) | ||
|
||
errorCode | ||
} else { | ||
"NOT_HTTP" | ||
} | ||
|
||
// 기능 오류 발견!!!! 반드시 수정 필요!!!!!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
여기가 팀블로그인듯
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.
항상 고민하면서 코드 짜는 거 멋있습니다~!