Skip to content

Commit

Permalink
fix: android error serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
divanc committed Feb 23, 2023
1 parent 6766f02 commit 2e51b52
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/android/src/main/kotlin/com/adapty/react/AdaptyContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ class AdaptyContext(
}

fun err(error: AdaptyError) {
promise.reject(error)
promise.reject("adapty", helper.toJson(error))
}
fun notImplemented() {
promise.reject("", "method not implemented")
promise.reject("adapty", "{\"adapty_code\":0,\"message\":\"method not implemented\"}")
}
fun argNotFound(name: String) {
promise.reject("Argument $name was not passed to a native module.", "")
promise.reject("adapty", "{\"adapty_code\":2003,\"message\":\"Argument $name was not passed to a native module\"}")
}
fun failedToSerialize() {
promise.reject("Failed to serialize data on a client side", "")
promise.reject("adapty", "{\"adapty_code\":23,\"message\":\"Failed to serialize data on a native side\"}")
}

inline fun <reified T: Any> parseJsonArgument(paramKey: String): T? {
Expand Down

0 comments on commit 2e51b52

Please sign in to comment.