diff --git a/README.md b/README.md index 08a7014..1f2bf94 100755 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ allprojects { project build.gradle ```groovy dependencies { - commonMainApi("dev.icerock.moko:errors:0.4.0") + commonMainApi("dev.icerock.moko:errors:0.5.0") } ``` diff --git a/errors/src/commonMain/kotlin/dev/icerock/moko/errors/mappers/ExceptionMappersStorage.kt b/errors/src/commonMain/kotlin/dev/icerock/moko/errors/mappers/ExceptionMappersStorage.kt index 7a75381..08e1354 100644 --- a/errors/src/commonMain/kotlin/dev/icerock/moko/errors/mappers/ExceptionMappersStorage.kt +++ b/errors/src/commonMain/kotlin/dev/icerock/moko/errors/mappers/ExceptionMappersStorage.kt @@ -167,4 +167,11 @@ object ExceptionMappersStorage { inline fun throwableMapper(): (e: E) -> T { return throwableMapper(T::class) } + + /** + * Factory method that allows getting exception description + */ + inline fun E.mapThrowable(): T { + return ExceptionMappersStorage.throwableMapper(T::class)(this) + } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7a19ea0..ab4f46f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ androidCoreTestingVersion = "2.1.0" coroutinesVersion = "1.5.0-native-mt" mokoMvvmVersion = "0.11.0" mokoResourcesVersion = "0.16.0" -mokoErrorsVersion = "0.4.0" +mokoErrorsVersion = "0.5.0" [libraries] appCompat = { module = "androidx.appcompat:appcompat", version.ref = "androidAppCompatVersion" }