Grant
Grant

Reputation: 41

How to enable custom UI error messages on Dialog Popups in JHipster 4.13.2

I'm loving the JHipster project, a big thank you to the team, its really a big time saver. I do however get a bit stuck on a few things. My latest issue is related to getting custom error alerts on the UI pages, specifically the dialog popups - doing create, delete, custom operations etc.

To replicate the issue, create any entity or go into the UserResource.delete() or createUser() REST function and force an exception to be thrown (changed the != to ==) the BadRequestAlertException exception as below:

if (userDTO.getId() == null) {
    throw new BadRequestAlertException("A new user cannot already have an 
        ID", "userManagement", "idexists");

I was expecting the error the show on the user-management-dialog.component.html as it has the declared tags:

<jhi-alert-error></jhi-alert-error>

But, all I got was the error in the server logs:

2018-02-06 15:49:17.025 ERROR 5352 --- [ XNIO-4 task-21] 
c.s.hr.oa.web.rest.util.HeaderUtil       : Entity processing failed, A new 
user cannot already have an ID

2018-02-06 15:49:17.027  WARN 5352 --- [ XNIO-4 task-21] 
o.z.p.spring.web.advice.AdviceTrait      : Bad Request: A new user cannot 
already have an ID

I'm obviously missing something minor here? Would really appreciate any pointers. I was reading in other posts linked below and seems it should work. I've tried a few of the suggestions but they are based on older version of Angular and JHipster. I'm on Release 4.13.3

Upvotes: 0

Views: 1750

Answers (1)

Grant
Grant

Reputation: 41

Auto upgrade to 4.14.0 works great, just re-add these 2 deps to the package.json

"web-animations-js": "^2.3.1",
"classlist.js": "^1.1.20150312"

The errors are now all working like a charm on the dialog popups!! Thank you!! Great job to the JHipster devs!!

Upvotes: 1

Related Questions