Hi! I am using DataStore for Kotlin multiplatform....
# multiplatform
k
Hi! I am using DataStore for Kotlin multiplatform. But to handle errors I need to receive java.io.IOException which is Android dependent. Is there any way to do error handling without depending on Multiplatform?
Copy code
try {
            dataStore.edit { preferences ->
                preferences[idKey] = value
            }
        } catch (e: IOException) {
            Timber.e(e, "Failed to store $idKey $value")
        }
r
DataStore defines a
androidx.datastore.core.IOException
in common which typaliases to
java.io.IOException
on JVM. So if you're not using multiplatform you should be able to use the java type.
k
Thanks!! Why is it recommended to use
<http://java.io|java.io>.IOException
if not using multiple platforms?