Commit bccddc2 1 parent 3864d83 commit bccddc2 Copy full SHA for bccddc2
File tree 1 file changed +7
-4
lines changed
src/main/kotlin/org/zowe/kotlinsdk
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,13 @@ import retrofit2.Response
13
13
*/
14
14
fun validateResponse (response : Response <* >? , defaultMessage : String = "") {
15
15
if (response?.isSuccessful != true ) {
16
- if (response?.errorBody()?.string().isNullOrBlank()) {
17
- throw Exception (" HTTP code = ${response?.code()} ; Message: ${response?.message()} " )
18
- } else {
19
- throw Exception (" ${if (defaultMessage.isBlank()) " " else " $defaultMessage . " }${response?.errorBody()?.string()} " )
16
+ val errorBody = response?.errorBody()?.string()
17
+ errorBody?.let {
18
+ if (errorBody.isBlank()) {
19
+ throw Exception (" HTTP code = ${response.code()} ; Message: ${response.message()} " )
20
+ } else {
21
+ throw Exception (" ${if (defaultMessage.isBlank()) " " else " $defaultMessage . " }${errorBody} " )
22
+ }
20
23
}
21
24
}
22
25
}
You can’t perform that action at this time.
0 commit comments