Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reactive Oracle client does not provide an Oracle-specific exception #24264

Closed
jsmrcka opened this issue Mar 11, 2022 · 3 comments
Closed

Reactive Oracle client does not provide an Oracle-specific exception #24264

jsmrcka opened this issue Mar 11, 2022 · 3 comments
Labels
Milestone

Comments

@jsmrcka
Copy link
Contributor

jsmrcka commented Mar 11, 2022

Describe the bug

Unlike other reactive DB clients (reactive-pg-client, reactive-mysql-client, reactive-mssql-client, reactive-db2-client), Reactive Oracle client (reactive-oracle-client) does not provide an Oracle-specific exception, something like OracleException, which would be thrown in case of a failure.

    @Inject
    OraclePool oraclePool;

    ...

    private Uni<String> getError() {
        return oraclePool.query("BAD QUERY")
                .execute()
                .onItem().transform(RowSet::iterator)
                .onItem().transform(iterator -> "dummy string")
                .onFailure(RuntimeException.class).recoverWithItem(e -> e.getClass().getName());
    }

Instead, it uses generic io.vertx.core.VertxException.

This makes it harder to e.g. handle DB-specific exceptions.

Instead of:

public class FailureHandler {
    @Route(path = "/*", type = Route.HandlerType.FAILURE, produces = "application/json")
    void databaseOracleConstraintFailure(OracleException e, HttpServerResponse response) {
        response.setStatusCode(400).end(Json.encode(new JsonObject().put("msg", e.getMessage())));
    }
}

you have to do:

public class FailureHandler {
    @Route(path = "/*", type = Route.HandlerType.FAILURE, produces = "application/json")
    void databaseOracleConstraintFailure(VertxException e, HttpServerResponse response) {
        if (e.getMessage().contains("Error Msg = ORA")) {
            response.setStatusCode(400).end(Json.encode(new JsonObject().put("msg", e.getMessage())));
        }
    }
}

Expected behavior

An Oracle-specific exception is thrown in case of a failure.

Actual behavior

Generic io.vertx.core.VertxException is thrown.

How to Reproduce?

reactive-oracle-client-reproducer.zip

unzip reactive-oracle-client-reproducer.zip
cd ./reactive-oracle-client-reproducer
./mvnw clean test

Output of uname -a or ver

Linux ... 5.16.12-200.fc35.x86_64

Output of java -version

openjdk version "11.0.14" 2022-01-18 OpenJDK Runtime Environment Temurin-11.0.14+9 (build 11.0.14+9) OpenJDK 64-Bit Server VM Temurin-11.0.14+9 (build 11.0.14+9, mixed mode)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.7.4.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.4

Additional information

No response

@geoand
Copy link
Contributor

geoand commented Mar 11, 2022

cc @tsegismont

@tsegismont
Copy link
Contributor

@jsmrcka can you please file an issue on https://github.com/eclipse-vertx/vertx-sql-client ? Thanks

@jsmrcka
Copy link
Contributor Author

jsmrcka commented Jun 30, 2022

Fixed in eclipse-vertx/vertx-sql-client#1160.
Brought into Quarkus in #24316 (0dbc247).
Verified on 2.10.0.Final.

@jsmrcka jsmrcka closed this as completed Jun 30, 2022
@geoand geoand added this to the 2.10.0.Final milestone Jun 30, 2022
jsmrcka added a commit to jsmrcka/quarkus-test-suite that referenced this issue Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants