Repository navigation
Report any exception from model code instead of crashing the generator [patch] - #65
Merged
Merged
Conversation
…r [patch] Deserialize<T> caught only JsonException, NotSupportedException, InvalidOperationException and ArgumentException, so a model constructor that threw NullReferenceException, FormatException or OverflowException escaped to the driver as CS8785 and lost every other file's output. It now reports every exception except OperationCanceledException and OutOfMemoryException, with the exception's type name in the reason. Fixes #41 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW4i7FzmxvaxCZgeCwe
|
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.



MetadataFile.Deserialize<T>caughtJsonException,NotSupportedException,InvalidOperationExceptionandArgumentException.System.Text.Jsonpasses the model's own constructor exceptions through unwrapped, so a model that didname.Trim()orint.Parse(size)threwNullReferenceException,FormatExceptionorOverflowException. Those reached the driver as CS8785, and the output of every other metadata file in the run was lost with it.Deserialize<T>now reports every exception asMetadataParseFailed, using<ExceptionType>: <message>as the reason. Two exceptions still propagate:OperationCanceledException, which the driver uses to stop a run, andOutOfMemoryException.JsonExceptionkeeps its own handler, which locates the failure. The XML remarks and the matching CLAUDE.md design note are updated.Tests:
AnyExceptionFromModelCodeIsReportedRatherThanCrashingTheGenerator, with oneDataRoweach forNullReferenceException,FormatExceptionandOverflowException. It drives a two-file fixture,ParsedPairGenerator, and asserts four things:result.Exceptionis null, there is exactly oneMetadataParseFailednamingthings.jsonand the exception type, andothers.jsonstill generates.mainand pass with the change.Fixes #41
Generated by Claude Code