Skip to content

Prevent crash on failed GRP evaluation#49

Merged
surajsept merged 2 commits into
mainfrom
bug/crash-on-gpr-error
Jul 27, 2025
Merged

Prevent crash on failed GRP evaluation#49
surajsept merged 2 commits into
mainfrom
bug/crash-on-gpr-error

Conversation

@sauter-roland
Copy link
Copy Markdown
Collaborator

Currently, a failed GPR evaluation can crash the whole GEMCAT run.
Returning NaN for the crashing GPR and continuing execution is preferable.

Copilot AI review requested due to automatic review settings July 27, 2025 14:21
@sauter-roland sauter-roland added the bug Something isn't working label Jul 27, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR prevents crashes in GEMCAT when GPR (Gene-Protein-Reaction) expression parsing fails by gracefully handling syntax errors and returning NaN instead of allowing the application to crash.

  • Adds exception handling around GPR expression parsing to catch SyntaxError exceptions
  • Returns NaN when parsing fails, allowing execution to continue
  • Includes debug logging to track failed parsing attempts
  • Bumps version from 1.4.0 to 1.4.1

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/gemcat/expression.py Adds try-catch block around parse_expr to handle SyntaxError and return NaN on failure
pyproject.toml Version bump from 1.4.0 to 1.4.1

Comment thread src/gemcat/expression.py
@surajsept surajsept enabled auto-merge July 27, 2025 20:10
@surajsept surajsept merged commit 29849c7 into main Jul 27, 2025
6 checks passed
@surajsept surajsept deleted the bug/crash-on-gpr-error branch July 27, 2025 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants