https://kotlinlang.org logo
Title
d

dave08

04/05/2020, 3:42 PM
Hi! It might be nice to add more specific failure types to
QueryResult
like if a Unique index was violated (maybe a setting to get an exception for that...?). Currently there's no real way to distinguish a generic failure in doing an insert, or a more specific one (unless we parse the error message?) @oshai?
o

oshai

04/05/2020, 5:45 PM
I think the driver itself is low-level so it's enough to provide error codes, and it is also what was done before and will break things to change that. but it should be possible to use error codes. see: https://github.com/jasync-sql/jasync-sql/blob/e9896d615b3b997ca0f05a67f21f6ab40f54bbaf/r2dbc-mysql/src/main/java/JasyncStatement.kt#L110
d

dave08

04/06/2020, 6:57 AM
Ok, thanks for that link! I didn't realize that there was an
errorCode
field (I also didn't think about casting to
MySQLException
...), it might be a nice addition to the Wiki... (if it's not there yet...).
o

oshai

04/07/2020, 7:50 AM
I will add it to the wiki, of course for postgres you need a different cast