Skip to content

DG: FEAT: Propagate error messages to the backend - #29

Merged
mberz merged 1 commit into
developfrom
dg/feat/surface_error_messages
Aug 20, 2026
Merged

DG: FEAT: Propagate error messages to the backend#29
mberz merged 1 commit into
developfrom
dg/feat/surface_error_messages

Conversation

@mberz

@mberz mberz commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

@mberz mberz added the enhancement New feature or request label Aug 20, 2026
@mberz
mberz requested a lite review from Copilot August 20, 2026 16:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the DG method container CLI entrypoint to capture runtime exceptions and propagate structured error information back to the backend via the JSON result file, aligning with backend changes in choras-org/backend#107.

Changes:

  • Wrap DG simulation execution with exception handling that writes an error object into the JSON result file.
  • Ensure the container exits with status code 1 on failure so the backend can detect unsuccessful runs.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +15 to 39
# Initialize Gmsh before running the simulation
gmsh.initialize()
try:
dg_method_object = DGMethod(json_file_path)
dg_method_object.run_simulation()
finally:
# Ensure that gmsh is finalized
gmsh.finalize()

# Outer except to ensure gmsh is finalized above before sys.exit is called
except Exception as e:
# Write error to result JSON so backend can read it
with open(json_file_path) as f:
data = json.load(f)
data['error'] = {'type': type(e).__name__, 'message': str(e)}
with open(json_file_path, 'w') as f:
json.dump(data, f, indent=4)

# Ensure the container exits with exit code 1 to indicate failure
# The status code is used by the backend to determine if the simulation
# was successful or not.
sys.exit(1)

# Save the results to a separate file
dg_method_object.save_results()
@mberz
mberz merged commit 6334938 into develop Aug 20, 2026
16 checks passed
@mberz
mberz deleted the dg/feat/surface_error_messages branch August 20, 2026 17:29
@github-project-automation github-project-automation Bot moved this from Backlog to Done in CHORAS planning Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants