From eba99f7e5f38d9501b37d9b188b6f324a947dc74 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 3 Jun 2026 22:24:51 +0900 Subject: fix(config,loader): wire JsonValidationException catch; drop unportable chain TODOs JsonConfigSource::manipulate_json now downcasts the validate_schema error to JsonValidationException (matching PHP's specific catch), restores the original contents, and surfaces e.get_errors(); other errors propagate. ArrayLoader's two version-parse catch sites only had TODOs for preserving the original exception as 'previous'. shirabe_semver raises generic anyhow errors (not shim exception types), so the existing catch-all is already faithful to PHP's catch (\UnexpectedValueException), and the flat shim exception structs intentionally hold no previous field; the wrapped message already carries the original cause. Remove the stale TODOs. Co-Authored-By: Claude Opus 4.8 --- crates/shirabe/src/package/loader/array_loader.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'crates/shirabe/src/package/loader/array_loader.rs') diff --git a/crates/shirabe/src/package/loader/array_loader.rs b/crates/shirabe/src/package/loader/array_loader.rs index e1cc60b..634bef8 100644 --- a/crates/shirabe/src/package/loader/array_loader.rs +++ b/crates/shirabe/src/package/loader/array_loader.rs @@ -195,7 +195,6 @@ impl ArrayLoader { { Ok(v) => version = v, Err(e) => { - // TODO(phase-b): preserve original exception chain via anyhow::Error::context return Err(UnexpectedValueException { message: format!( "Failed to normalize version for package \"{}\": {}", @@ -761,9 +760,7 @@ impl ArrayLoader { let parsed_constraint = match self.version_parser.parse_constraints(&constraint) { Ok(c) => c, - Err(e) => { - // TODO(phase-b): preserve original exception chain - let _ = &e; + Err(_e) => { return Err(UnexpectedValueException { message: format!( "Link constraint in {} {} > {} should be a valid version constraint, got \"{}\"", -- cgit v1.3.1