Skip to content

Commit 0b25efe

Browse files
committed
fix: code refactoring & ios test case updated
1 parent 358da37 commit 0b25efe

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package helpers
2+
3+
fun mapToThrowable(errorMap: Map<String, Any?>): Throwable {
4+
val errorDetails = errorMap["error"] as? Map<String, Any?> ?: return Exception("Unknown error")
5+
6+
val code = errorDetails["code"] as? String ?: "UNKNOWN_ERROR"
7+
val message = errorDetails["message"] as? String ?: "An unknown error occurred"
8+
9+
return Exception("Stripe Error ($code): $message")
10+
}

0 commit comments

Comments
 (0)