Improve error handling: surface swallowed errors#3
Merged
Conversation
- owned_compile: log cache write failures and metadata write failures instead of silently discarding them; populate report fields on import resolution failure so callers can see the reason - main (boot image metadata): warn on sidecar write failure instead of silently dropping it - main (cmd_eval): propagate temp-dir creation error instead of ignoring it - compiler CLI: replace File::create().unwrap() with proper match so metadata file creation errors are reported rather than panicking - backend capabilities (in-cli + rust-driver): log unsupported target errors instead of silently falling back to RawBinary - language_gates: log parse errors when a gate check fails so the reason is visible in terminal output - package_manifest: include the underlying error in source-read-failed and surface-parse-failed reason strings - package_extern: warn when source file cannot be read instead of silently substituting an empty string Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Fixes pre-existing formatting drift plus formatting for the new error-handling code. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Replace or_else with or for constant match arms (unnecessary_lazy_evaluations) and collapse nested if (collapsible_if). Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
Devin is archived and cannot be woken up. Please unarchive Devin if you want to continue using it. |
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
Several production code paths silently discard errors via
let _ =orErr(_) =>, making failures invisible when debugging. This PR surfaces those errors through stderr warnings or structured report fields.Key changes:
compile_cache::write_cached_reportresult was discarded — now logs[cache] warning: …on failureowned_compile::write_component_metadata, boot image sidecar inmain) —Err(_) => None/let _ = fs::write(…)replaced witheprintln!warningscompile_owned— waseprintln!only, now also populatesreport.reason_code = "import-resolution-failed"+report.reason/report.errorso callers see the failure in the structured reportcompiler/rust-driver/crates/cli) —File::create(&md_path).unwrap()replaced with proper match to avoid panics on file creation errorsbackend_capabilities(bothin-cliandrust-driver) —Err(_)fromselect_backendnow logs[backend] unsupported target …: {e}before falling backlanguage_gates— parse errors now logged with[gate] parse failed for …: {e}package_manifest::source_identity_for_path—Err(_)branches now include the underlying error in thereasonfield (e.g."source-read-failed: No such file …")package_extern—fs::read_to_string(…).unwrap_or_default()replaced with explicit match + warningcmd_evaltemp dir creation —let _ = create_dir_all(…)replaced with?propagationLink to Devin session: https://app.devin.ai/sessions/926917492b93439180c3bc7bbd6c4c17
Requested by: @undivisible