Ares-Defence-Labs/KmpEssentials

Add error logs

Closed this issue · 2 comments

Hello.

Example of your code:

            if (filePath.isNotBlank() && NSFileManager.defaultManager.fileExistsAtPath(filePath)) {
                KmpMainThread.runViaMainThread {
                    val physicalFile = NSData.dataWithContentsOfFile(filePath)
                    val activityController = UIActivityViewController(listOf(physicalFile), null)

                    UIApplication.sharedApplication.keyWindow?.rootViewController()
                        ?.presentViewController(activityController, true, null)
                }
            }

But what if if will not be satisfied? I will just see no result and will not know why.

Please consider to make else cases with logs on what is wrong for debug purpose.

Hey,
I've added this feature into v1.1.4

If any issue occurs, you should see something like this on your logcat (on Android Studio), and Console Log (on Xcode).
screenshot_android_studio

You can find documentation on error codes here.
https://thearchitect123.github.io/ArtifactsDocProduction/develop/kotlin/multiplatform/kmpessentials/modules/errorCodes

You can also gain access to Mimes more easily using:
com.architect.kmpessentials.internal.Mimes

It avoids you having to hardcode it yourself