xxfast / KStore

A tiny Kotlin multiplatform library that assists in saving and restoring objects to and from disk using kotlinx.coroutines, kotlinx.serialisation and kotlinx.io
https://xxfast.github.io/KStore/
Apache License 2.0
484 stars 15 forks source link

Refactor move exception handling to the decoder #28

Closed xxfast closed 1 year ago

xxfast commented 1 year ago

Previously, decoding a malformed file will return the default. This behaviour is not always desirable and might be unexpected. Hence, I'm no longer making this behaviour the default.

With this change, the default decoder of storeOf() will throw if the file is malformed. To handle this, you'll need to implement your own safe decoder, depending on the behaviour you want. See VerstionStore.kt for an example of a custom behaviour

github-actions[bot] commented 1 year ago

Code Coverage

File Coverage [97.85%] :white_check_mark:
kstore/src/commonMain/kotlin/io/github/xxfast/kstore/KStore.kt 100.00% :white_check_mark:
kstore/src/commonMain/kotlin/io/github/xxfast/kstore/extensions/KVersionedStore.kt 92.59% :white_check_mark:
kstore/src/commonTest/kotlin/io/github/xxfast/kstore/KStoreTests.kt 97.63% :white_check_mark:
kstore/src/commonTest/kotlin/io/github/xxfast/kstore/KVersionedStoreTests.kt 98.78% :white_check_mark:
Total Project Coverage 98.55% :white_check_mark: