From bbb2f9454b6580fcbd337ced61b5a1888d52ce8d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 5 Jun 2026 01:50:16 +0900 Subject: refactor(io): model ask_and_validate validators with anyhow::Result PHP's askAndValidate throws when a validator rejects input. Change the IOInterface validator callback and return type to anyhow::Result so the call sites can return Err instead of panic, faithfully modeling the throw semantics already supported by the Question layer. Co-Authored-By: Claude Opus 4.8 --- crates/shirabe/src/io/null_io.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/src/io/null_io.rs') diff --git a/crates/shirabe/src/io/null_io.rs b/crates/shirabe/src/io/null_io.rs index 85a5fa5..0a83bff 100644 --- a/crates/shirabe/src/io/null_io.rs +++ b/crates/shirabe/src/io/null_io.rs @@ -70,11 +70,11 @@ impl IOInterfaceImmutable for NullIO { fn ask_and_validate( &self, _question: String, - _validator: Box PhpMixed>, + _validator: Box anyhow::Result>, _attempts: Option, default: PhpMixed, - ) -> PhpMixed { - default + ) -> anyhow::Result { + Ok(default) } fn ask_and_hide_answer(&self, _question: String) -> Option { -- cgit v1.3.1