SQLDelight/KMP : is there a simple/clean way to catch a specific SQL exception in the commonMain code?
(I feel like I have to create my own SqlExceptionMapper with expect/actual but hope there's already something available.)
glureau
02/20/2023, 3:42 PM
I wrote this very basic mapper that's a bit scary to me given my very little sql knowledge especially when dealing with all those errors in every platforms. Could be great to have that directly from sqldelight no?
My basic usecase is too distinguish mainly between constraint issues (uniqueness/pk broken) and system errors (full/nomem/corrupt/...). I want to avoid to duplicate the uniqueness logic in the common code (since sql can ensure it efficiently and concisely).
Thanks for the link, I understand the concerns from your point of view: more stuff to maintain and a risk of hiding some details, I presume it depends of the library consumer needs so I'll probably stay with my mapper (knowing&documenting the risks).