Improve error handling at SQL side (use RAISE EXCEPTION WITH ERRORCODE) to simplify client-side integration.
The following discussions from !14 (merged) should be addressed:
-
@bwrona started a discussion: Why InternalError exception class is used here ? What if some other exception will be raised (i.e.
StatementError
) -
@bwrona started a discussion: Probably RAISE EXCEPTION ... WITH ERRORCODE should be used to introduce custom class of exceptions and exact codes for each case. Then they could be much better recognized and wrapped at SQL client side.
See usage here: https://gitlab.syncad.com/hive/hivemind/-/blob/develop/hive/db/sql_scripts/utility_functions.sql#L46