From e583112899cbea7494ffdd73d7de380dd5f808c4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 10 Jun 2026 00:54:22 +0900 Subject: feat(phase-c): resolve exception-handling phase-b TODOs * Catch specific exception types instead of broad/placeholder handling. * Drop the shim Countable trait. --- crates/shirabe/src/json/json_file.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'crates/shirabe/src/json/json_file.rs') diff --git a/crates/shirabe/src/json/json_file.rs b/crates/shirabe/src/json/json_file.rs index a185084..cf92a77 100644 --- a/crates/shirabe/src/json/json_file.rs +++ b/crates/shirabe/src/json/json_file.rs @@ -404,9 +404,9 @@ impl JsonFile { validator.check(&data_converted, &schema_data)?; if !validator.is_valid() { - // TODO(phase-b): Validator::get_errors currently returns Vec; original PHP - // exposes [{property, message}, ...]. Until shim is enriched, surface raw error - // strings without prop/message splitting. + // TODO(phase-c): Validator::get_errors currently returns Vec; original PHP + // exposes [{property, message}, ...]. Until the validator shim is enriched, surface raw + // error strings without prop/message splitting. let errors: Vec = validator.get_errors(); return Err(JsonValidationException::new( format!("\"{}\" does not match the expected JSON schema", source), @@ -431,8 +431,9 @@ impl JsonFile { let json = match json { Some(j) => j, None => { - // PHP: self::throwEncodeError(json_last_error()); - // TODO(phase-b): throw an error; downstream callers expect a String + // PHP: self::throwEncodeError(json_last_error()), which throws \RuntimeException. + // TODO(phase-c): faithfully propagating this requires encode/encode_with_options to + // return Result, a signature change rippling across ~53 call sites. Self::throw_encode_error(json_last_error()).unwrap_or_default(); String::new() } -- cgit v1.3.1