Fixes #39285 - TableIndexPage does not show error messages correctly#10974
Fixes #39285 - TableIndexPage does not show error messages correctly#10974Lukshio wants to merge 1 commit intotheforeman:developfrom
Conversation
adamruzicka
left a comment
There was a problem hiding this comment.
We have variants of this all over the place (sometimes we just use full_messages, sometimes we fallback to message, sometimes we just take first element from full_messages, ...). Would it make sense to add a helper to extract errors from backend responses and reuse it everywhere rather than re-implementing it in every place in a slightly different way?
@adamruzicka I have concerns that we have that many implementations, that the final helper would be extremely large. And as you said, in each implementation we take something different. |
|
I can't help myself but this still feels like treating a symptom rather than the root cause.
Would it be larger than the sum of all the custom partial implementations we already have? If we had one final helper, would it prevent us from running into issues such as this one where the custom implementation just didn't cut it?
Assuming the backend replies are more or less standardized, that is a problem on its own, not a reason for adding yet another one. |
|
@adamruzicka You are right that the total number of lines if way bigger. I think that best way would be use it directly in APIActions so we can basically remove all of this parsing across its usage. But after that we will have to change all of its usages. Or we can just replace all the parsers with new helper. But the change would be much bigger and it will require some time. So in my opinion, I would use this as a quick fix. And then schedule some task for refinement. This PR was meant to fix some robottelo tests fails and it's linked to the ModelsUpdate so I was thinking that this is good opportunity to fix it |
Please do file a redmine. |
More like adding a semi-dynamic prefix to make the error read like "Failed to delete hardware model: asd is used by ...". |
It is general component, so adding specific message would require to add multiple new props, but I added some general prefix that suits well. |


Add parsing error messages from server to show actual error
e.g. deleting HW model in use throws error
Before: Request Failed with status code 422
After: »test is used by host1.example.com«