quarkiverse / quarkus-renarde

Server-side Web Framework with Qute templating, magic/easier controllers, auth, reverse-routing
Apache License 2.0
73 stars 16 forks source link

Handle exception but force a rollback #199

Open gbourant opened 4 months ago

gbourant commented 4 months ago

As discussed in issue 38839, if we use a try catch block and return a template then the transaction is not rollbacked. In order to force a rollback we need something like this

@Path("login")
public TemplateInstance loginPage(User user)
        try {
            authService.register(user);
        } catch (Exception e) {
            // transaction is not rollbacked
            return AdminTemplate.auth(e);
        }
        return AdminTemplate.auth();
}