Skip to content

[26.0] Raise MessageException instead of generic Exception in rules_dsl#22285

Merged
mvdbeek merged 1 commit intogalaxyproject:release_26.0from
mvdbeek:rule_message_exception
Mar 30, 2026
Merged

[26.0] Raise MessageException instead of generic Exception in rules_dsl#22285
mvdbeek merged 1 commit intogalaxyproject:release_26.0from
mvdbeek:rule_message_exception

Conversation

@mvdbeek
Copy link
Copy Markdown
Member

@mvdbeek mvdbeek commented Mar 28, 2026

Fixes #22100. When a regular expression fails to match in apply_regex(), the generic Exception was not caught by the API layer, resulting in an unhandled server error. Using MessageException ensures the error message is properly surfaced to users and matches error handling for other scenarios in lib/galaxy/util/rules_dsl.py.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

Copy link
Copy Markdown
Member

@jmchilton jmchilton left a comment

Choose a reason for hiding this comment

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

This file is just as usable outside the context of a web app or Galaxy - I don't think throwing MessageException from here is good design. I would find a Galaxy-concern to catch this in an translate it to a message exception here - maybe in the collections manager.

@mvdbeek
Copy link
Copy Markdown
Member Author

mvdbeek commented Mar 30, 2026

We will have to throw a known entity though (a catch all bare exception might be hiding "real" bugs), why not directly make it a more specific MessageException subclass ?

Fixes galaxyproject#22100. When a regular expression fails to match in apply_regex(),
the generic Exception was not caught by the API layer, resulting in an
unhandled server error. Using MessageException ensures the error message
is properly surfaced to users.
@mvdbeek mvdbeek force-pushed the rule_message_exception branch from c064e0c to 3c29b7a Compare March 30, 2026 13:24
@mvdbeek mvdbeek merged commit 7693cb4 into galaxyproject:release_26.0 Mar 30, 2026
54 of 55 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in Galaxy Dev - weeklies Mar 30, 2026
@github-actions
Copy link
Copy Markdown

This PR was merged without a "kind/" label, please correct.

@nsoranzo nsoranzo deleted the rule_message_exception branch March 30, 2026 17:18
@ahmedhamidawan ahmedhamidawan modified the milestones: 26.1, 26.0 Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

4 participants