ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
137 stars 58 forks source link

Data source level error messages are not propagate correctly in persist clients with transactions #6859

Closed daneshk closed 1 month ago

daneshk commented 1 month ago

Description: When there is a Data source level error like unique key constraint violation etc, the error is not propagate correctly to the application in persist client with transaction enabled. Instead, it gives below cast exception,

error("{ballerina}TypeCastError",message="incompatible types: 'sql:DatabaseError' cannot be cast to '(persist.sql:ExecutionResult|persist:Error)'")
                                callableName: executeNativeSQL moduleName: ballerinax.persist.sql$test.1.H2RainierClient fileName: tests/h2_rainier_generated_client.bal lineNumber: 350
                                callableName: h2NativeTransactionTest moduleName: ballerinax.persist.sql$test.1.tests.h2-native-tests fileName: tests/h2-native-tests.bal lineNumber: 224
                                callableName: h2NativeTransactionTest$lambda74$ moduleName: ballerinax.persist.sql$test.1.tests.test_execute-generated_1 fileName: tests/test_execute-generated_1.bal lineNumber: 78

Affected Versions: 2201.10.0-rc1

github-actions[bot] commented 1 month ago

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.