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

Error handling problem #28

Open
myashchenko opened this issue Nov 20, 2018 · 4 comments
Open

Error handling problem #28

myashchenko opened this issue Nov 20, 2018 · 4 comments

Comments

@myashchenko
Copy link

myashchenko commented Nov 20, 2018

I've implemented a small application that connects to Postgres via this driver. I have only one method that triggers database and this method looks like that:

@Override
public Mono<User> findByEmail(final String email) {
    try (final var session = dataSource.getSession()) {
        final var future = session.<List<Result.RowColumn>>rowOperation("select * from users where email = $1")
                    .set("$1", email, AdbaType.VARCHAR)
                    .collect(Collectors.toList())
                    .submit()
                    .getCompletionStage()
                    .thenApply(rc -> toUser(rc.get(0)))
                    .toCompletableFuture();
        return Mono.fromFuture(future);
    }
}

I have a running instance of PG database and the underlying DB schema doesn't have a "users" table. So when I execute the code above I expect to receive some user-friendly message like "Table 'users' doesn't exist". Instead of this, the method hangs and return neither error nor null. I tried to wait a few minutes but it continues hanging without returning any result.

Could you please advise if it is a bug in my code or a bug in the driver itself? Thank you

UPD
I use 0.1.0-ALPHA version of the library

@alexanderkjall
Copy link
Collaborator

Hi, thanks for testing it out.

Could you also show the connection url that you use (no username or password necessary) and i'll try to replicate the issue and find the bug tonight.

@myashchenko
Copy link
Author

My configuration:

@Bean
public DataSource dataSource() {
    return DataSourceFactory.newFactory("org.postgresql.adba.PgDataSourceFactory")
                .builder()
                .url("jdbc:postgresql://localhost:5432/webflux")
                .username("postgres")
                .password("postgres")
                .build();
}

@alexanderkjall
Copy link
Collaborator

I tried to recreate your bug here https://github.com/alexanderkjall/pgadba-triage-bug28 without success.

I run that code with:

mvn clean package && java -jar target/gs-reactive-rest-service-0.1.0.jar

and access the function with:

curl localhost:8080/email

If I doesn't have a users table i get this response:

{"timestamp":"2018-11-20T18:08:19.881+0000","path":"/email","status":500,"error":"Internal Server Error","message":"jdk.incubator.sql2.SqlException: relation \"users\" does not exist"}

And with a users table with a user in it:

{"email":"test"}

Maybe the error is somewhere in the toUser function, could you make a pull request to the triage repository in order to reproduce the bug?

@myashchenko
Copy link
Author

I will try again a little bit later. Will drop a message when I have a result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants