return complete Throwable in PostgresClient's replyHandlers

Description

When there is a failure in PostgresClient the replyHandler does not get the complete Throwable, it only gets the message:

  • query.cause().getMessage()

  • e.getMessage()

It should get the complete Throwable:

  • query.cause()

  • e

That way the invoking program can better handle the different kinds of exceptions, for example to create special return codes and explanations on database constraint errors regarding unique keys or foreign keys. The complete Throwable enables the invoking program to do tests like this:

if (asyncResult.getCause() instanceof GenericDatabaseException)
and to directly access the fields of the map GenericDatabaseException.errorMessage().fields().

Environment

None

Potential Workaround

None

Checklist

hide

TestRail: Results

Activity

Show:

Julian Ladisch May 8, 2017 at 10:28 AM

Fixed in v10.2.0

Julian Ladisch May 3, 2017 at 8:49 PM

Exception handlers should preserve the original exceptions: https://jira.sonarsource.com/browse/RSPEC-1166

Done

Details

Assignee

Reporter

Labels

Priority

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs

Created May 3, 2017 at 8:17 PM
Updated May 8, 2017 at 10:28 AM
Resolved May 8, 2017 at 10:28 AM
TestRail: Cases
TestRail: Runs

Flag notifications