Closed mirromutth closed 5 years ago
For MySQL, probably SQL state prefixes (23
for constraint validations, 42
SQL grammar errors) are the best bet for mapping.
You might want to cross-check against Spring's Exception mapping.
Here's R2DBC MS SQL's ExceptionFactory
that might contain a useful approach for exception mapping.
Now the issue turns to implement an ExceptionFactory
similar with r2dbc-mssql
, providing ErrorMessage
conversion logic.
@mp911de I saw Spring JDBC Exception mapping and have a problem: error code 1, 630, 839, 840 and 893 is undefined in MySQL documents. They sounds like 1630, 1839, 1840 and 1893 (1 is also unknown yet), but 1630, 1839, 1840 and 1893 did not means a violation of an integrity constraint.
So, where I should look for their definitions? Or should I just remove their mappings from ExceptionFactory
?
The exception mapping in Spring Framework is quite dated (11 years) so I'm not able to find the origins of the mapping. In doubt, I'd rather go by the MySQL documentation and use Spring only as an inspiration.
Completed ExceptionFactory
general mappings, should keep watching more error codes. This issue would be close.
The current project use CUSTOM exceptions that inherits from
R2dbcException
, that does NOT conform to the r2dbc specification. See https://github.com/r2dbc/r2dbc-spi/pull/53.