0

I'm trying to save a record

    public Mono<UUID> save(Post p) {
        return databaseClient.sql("INSERT INTO  posts (title, date, content) VALUES (:title, :date, :content)")
                .filter((statement, executeFunction) -> statement.returnGeneratedValues("id").execute())
                .bind("title", p.getTitle())
                .bind("date", DateTimeFormatter.ISO_LOCAL_DATE_TIME.parse(p.getDate())) //here exception
                .bind("content", p.getContent())
                .fetch()
                .first()
                .map(r -> (UUID) r.get("id"))
                .onErrorResume(err -> {
                    log.error(e);
                    return Flux.empty();
                });
    }

I expected if the date is in the wrong format, the error will be handled in the onErrorResume block, but I get the error operator called default onErrorDropped

I tried to take out the onErrorResume block, but that doesn't work too

    public Mono<UUID> saveOne(Post p) {
        return save(p)
                .onErrorResume(err -> {
                    log.error(e);
                    return Flux.empty();
                });
    }
Inessa
  • 27
  • 3

0 Answers0