Repository navigation
fix: return Result from draw() and save_gexf() (closes #33) - #34
Merged
danielhuici merged 3 commits intoSep 1, 2026
Merged
Conversation
…carding errors (closes reverseame#33)
Author
2 of 3 tasks
Semantic resolution: reverseame#25 moved draw()/save_gexf() from the facade to export::gexf, so this branch's changes to the old location are ported there instead: draw() returns Result<(), Box<dyn Error>>, save_gexf() propagates I/O and GEXF serialization errors with ? instead of let _ / unwrap. The port is smaller than the original commit because the gexf fork adopted in reverseame#25 had already removed add_attribute_schema and one of the two unwrap call sites.
Update the interface document, the C&C connector table and the README example for the error propagation introduced by reverseame#34.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
draw()exports the HNSW graph to GEXF files and had two silent failure modes.gexf.to_string()can fail and was called through.unwrap(), which panics the whole process on a serialization error instead of surfacing it. Separately,draw()calledsave_gexf()throughlet _ = ..., discarding itsstd::io::Resultand swallowing I/O errors fromfs::write(disk full, no permission, invalid path) while still returning as if the export had succeeded.Changes
src/controllers/apotheosis.rs: bothdraw()and the privatesave_gexf()now returnResult<(), Box<dyn std::error::Error>>. Theto_string()calls use?instead of.unwrap(), and thesave_gexf()call indraw()uses?instead oflet _ =.GexfErrorfrom thegexfcrate already implementsstd::error::Errorviathiserror, so it converts intoBox<dyn std::error::Error>through?with no extra work.src/orsrc/bin/callsdraw(), so nothing there needed updating.tests/api_contract.rs:draw_produces_one_gexf_file_per_layer, the one test callingdraw(), now calls.expect()on the result.Test plan
Verified locally with the same commands CI runs:
cargo clippy --all-targets --all-features -- -D warningsclean,cargo fmt --checkclean, and all 44 tests passing.Also reproduced the silent I/O failure live before fixing it: calling
draw()with a path whose parent directory does not exist returnedOkwith no panic and no file written, confirming the bug was real and not just a static-analysis finding.Closes #33.