Skip to content

Commit

Permalink
Expose error & description in RestException (#180)
Browse files Browse the repository at this point in the history
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
  • Loading branch information
jan-tennert committed Jun 5, 2023
1 parent 2daa83a commit d3ee40f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
object Versions {

const val PROJECT = "1.0.2"
const val PROJECT = "1.0.3-dev"

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import io.ktor.client.statement.request

/**
* Base class for all response-related exceptions
* @param error The error returned by supabase
* @param description The error description returned by supabase
*/
sealed class RestException(message: String): Exception(message) {
sealed class RestException(val error: String, val description: String?, message: String): Exception(message) {

constructor(error: String, response: HttpResponse, message: String? = null): this("""
constructor(error: String, response: HttpResponse, message: String? = null): this(error, message, """
$error${message?.let { " ($it)" } ?: ""}
URL: ${response.request.url}
Headers: ${response.request.headers.entries()}
Expand Down

0 comments on commit d3ee40f

Please sign in to comment.