7134 errorhandlers refactored - code only#7170
Conversation
…ated code and solve problems like IQSS#7134.
…or ArrayOutOfBoundsException, NullPointerException and ServeletException perfectly replaced by ThrowableHandler. IQSS#7134
…text storage of secrets. IQSS#7134
…e API. IQSS#7134 Only supports error responses for now.
… JSONResponseBuilder for crafting responses and logging. IQSS#7134
|
@poikilotherm I'm still seeing the 406 errors: Not sure what is causing it but might be in export since I had just published the dataset. I was also just creating a new one but had not saved yet, just opened the edit form. Oh Sorry, that was the initial stack trace, the following stack held the 406: |
Adding a null check on the content type to fix what @kcondon saw in testing. @poikilotherm - if there's a better fix, go ahead and revert this - just wanted to keep testing moving.
|
@poikilotherm In the spirit of not following instructions and acting randomly, I have started creating a dataset in the UI, modified the host dv so it is invalid and not completed any required fields other than title, then saved. Big stack traces in log, ui kind of stuck in grayed out view. On Demo, form validation catches it and presents error to user. Not sure whether it is related to these changes or not. [2020-08-10T21:00:00.567+0000] [Payara 5.201] [WARNING] [] [javax.enterprise.resource.webcontainer.jsf.lifecycle] [tid: _ThreadID=90 _ThreadName=http-thread-pool::jk-connector(4)] [timeMillis: 1597093200567] [levelValue: 900] [[ |
|
@poikilotherm After discussing with Jim, I understand these error handlers are for REST api only and that the UI, though it may call same underlying code, does not follow the same error handling path. So, I will focus on API errors here and maybe open a new issue for UI behavior I'm seeing. |
|
Thx @qqmyers for handling this. Was a bit late yesterday for me... 😉 I'm fine with returning a JSON null value, although it's debatable if one would rather exclude the field from the response. Let's stick with it as is now 👍 @kcondon are any problems remaining with the 406 errors or all set now? (I assume as you merged, but wanted to make sure everything is fine now...) |
|
@poikilotherm Everything is set for now, thanks. |
NOTE: this is a successor to PR #7136 as requested by @scolapasta, containing the code only.
What this PR does / why we need it:
Which issue(s) this PR closes:
Closes #7134
Special notes for your reviewer:
I do hope the scope is not to big. I did not change the remaining two exception handlers for JSON and constraints to keep it smaller. Happy to change those if you think that makes sense.
One might also argue that special messages for Error 403 and 405 are not of much use. Happy to delete those.
I could also switch the Jersey Error 500 message to be the same as in ThrowableHandler.
The 302 and 307 were added because sometimes you might want to see a proper message via API, for example when you don't auto-follow redirects with
curlet al.I'm not sure if we should add a comment about the logging to the docs.
Suggestions on how to test this:
After deployment:
asadmin set-log-levels edu.harvard.iq.dataverse.api.errorhandlers.ThrowableHandler=FINESTand go for a 404 errorDoes this PR introduce a user interface change? If mockups are available, please link/include them here:
Ah API isn't classic UI, so let's say no.
Is there a release notes update needed for this change?:
Nope.
Additional documentation:
None.