commonMain.io.revenuemonster.sdk.util.RMException.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rm-kotlin-sdk-jvm Show documentation
Show all versions of rm-kotlin-sdk-jvm Show documentation
Revenue Monster Kotlin Multiplatform SDK
package io.revenuemonster.sdk.util
import io.revenuemonster.sdk.model.Error
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
class RMException(response : String) : Exception(response){
private val json = Json {
this.ignoreUnknownKeys = true
this.coerceInputValues = true
}
private val e = json.decodeFromString(this.message!!)
val errorCode = e.error.code
val errorMessage = e.error.message
}