Skip to content

Commit 1976a41

Browse files
committed
Revert changes in HttpException
Keep HttpException public, as it is returned as the original exception when an HTTP error occurs.
1 parent add42d2 commit 1976a41

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

gravatar/api/gravatar.api

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,11 @@ public final class com/gravatar/services/GravatarResult$Success : com/gravatar/s
750750
public fun toString ()Ljava/lang/String;
751751
}
752752

753+
public final class com/gravatar/services/HttpException : java/lang/RuntimeException {
754+
public final fun getCode ()I
755+
public fun getMessage ()Ljava/lang/String;
756+
}
757+
753758
public final class com/gravatar/services/ProfileService {
754759
public static final field LOG_TAG Ljava/lang/String;
755760
public fun <init> ()V

gravatar/src/main/java/com/gravatar/services/HttpException.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import retrofit2.Response
55
/**
66
* Exception thrown when an HTTP error occurs in a non-cathing method.
77
*
8-
* [rawErrorBody] The raw error body of the response.
98
* [code] The HTTP status code.
9+
* [message] The HTTP status message.
1010
*/
11-
internal class HttpException internal constructor(response: Response<*>) : RuntimeException() {
12-
val rawErrorBody: String? = response.errorBody()?.string()
13-
val code: Int = response.code()
11+
public class HttpException internal constructor(response: Response<*>) : RuntimeException() {
12+
internal val rawErrorBody: String? = response.errorBody()?.string()
13+
public val code: Int = response.code()
14+
public override val message: String = "HTTP ${response.code()} $rawErrorBody"
1415
}

0 commit comments

Comments
 (0)