Skip to content

Fixes #39285 - TableIndexPage does not show error messages correctly#10974

Open
Lukshio wants to merge 1 commit intotheforeman:developfrom
Lukshio:fixTableIndexPage
Open

Fixes #39285 - TableIndexPage does not show error messages correctly#10974
Lukshio wants to merge 1 commit intotheforeman:developfrom
Lukshio:fixTableIndexPage

Conversation

@Lukshio
Copy link
Copy Markdown
Contributor

@Lukshio Lukshio commented May 5, 2026

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«

Copy link
Copy Markdown
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@Lukshio
Copy link
Copy Markdown
Contributor Author

Lukshio commented May 5, 2026

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.

@adamruzicka
Copy link
Copy Markdown
Contributor

I can't help myself but this still feels like treating a symptom rather than the root cause.

that the final helper would be extremely large

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?

And as you said, in each implementation we take something different.

Assuming the backend replies are more or less standardized, that is a problem on its own, not a reason for adding yet another one.

@Lukshio
Copy link
Copy Markdown
Contributor Author

Lukshio commented May 6, 2026

@adamruzicka You are right that the total number of lines if way bigger.
So as a part of implementing new helper.

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

@adamruzicka
Copy link
Copy Markdown
Contributor

And then schedule some task for refinement.

Please do file a redmine.

@Lukshio
Copy link
Copy Markdown
Contributor Author

Lukshio commented May 7, 2026

@adamruzicka
Copy link
Copy Markdown
Contributor

with my pedantic hat on:
Would it be possible to mention what was the operation that actually failed?

image

@Lukshio
Copy link
Copy Markdown
Contributor Author

Lukshio commented May 7, 2026

with my pedantic hat on: Would it be possible to mention what was the operation that actually failed?

image

You mean to keep both messages?

@adamruzicka
Copy link
Copy Markdown
Contributor

You mean to keep both messages?

More like adding a semi-dynamic prefix to make the error read like "Failed to delete hardware model: asd is used by ...".

@Lukshio Lukshio force-pushed the fixTableIndexPage branch from e1364a1 to 7d6ec1d Compare May 7, 2026 15:23
@Lukshio
Copy link
Copy Markdown
Contributor Author

Lukshio commented May 7, 2026

You mean to keep both messages?

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.

Copy link
Copy Markdown
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants