Skip to content

Errors inside a transaction lose SQLState and the vendor code #109

Closed

Description

@magnusp

In auto-commit mode, executeOneShot throws LibsqlException, and LibsqlErrorMapper converts it. Inside a transaction, a StreamResult.Error becomes new SQLException(err.error().message()). The SQLState, the vendor code, and the constraint categorization are lost.

The same failing INSERT, for example a unique violation, produces a different exception type depending on autoCommit. Since #64, every connection with setAutoCommit(false) takes the unmapped path. Frameworks that branch on SQLState behave differently.

Sites:

  • LibsqlConnection.executeStatement
  • beginTransaction
  • endTransaction
  • extractBatchResults

Expected:

  • Route HranaError through the mapper at all four sites.
  • Add a test that checks the exception type and SQLState for a unique violation in both modes.

Activity

  1. added
    bugSomething isn't working
    P2Normal priority: edge case, feature gap, or test/process improvement
    on Oct 22, 2026
  2. added a commit that references this issue on Oct 23, 2026
    de31dc6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority: edge case, feature gap, or test/process improvementbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions