Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 500 error when loading table view #4828

Merged
merged 2 commits into from Jan 30, 2024
Merged

Conversation

noliveleger
Copy link
Contributor

@noliveleger noliveleger commented Jan 30, 2024

Description

Fix an error when - under certain circumstances - the table view does not load and display Server Error(500)

Notes

#4811 expected every Asset to have $xpath injected in its content. It may be not the case for old projects which have not been edited at least once since version 2.022.44a. Therefore #4811 bug fix crashes on KeyError $xpath.

@noliveleger noliveleger requested a review from jnm January 30, 2024 16:52
@noliveleger noliveleger self-assigned this Jan 30, 2024
@jnm jnm added the CRITICAL Red alert! Fix me ASAP! label Jan 30, 2024
Comment on lines 571 to 572
if str(e).strip("'") != '$xpath':
raise e
Copy link
Member

Choose a reason for hiding this comment

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

I'm not a big fan of this when it's possible to isolate the logic that might generate the exception 🙈
For something like, say, handling an exception raised by a library like pyxform, when we need to distinguish between exceptions that have the same class, I'm fully okay with string comparisons.

Copy link
Member

Choose a reason for hiding this comment

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

Proposed change: 54fd5d9

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not a big fan of this when it's possible to isolate the logic that might generate the exception 🙈 For something like, say, handling an exception raised by a library like pyxform, when we need to distinguish between exceptions that have the same class, I'm fully okay with string comparisons.

💯

@noliveleger noliveleger merged commit 45faa6c into release/2.023.52 Jan 30, 2024
4 checks passed
@noliveleger noliveleger deleted the fix-xpath-keyerror branch January 30, 2024 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix CRITICAL Red alert! Fix me ASAP!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants