validation: avoid passing large struct in Err

This commit is contained in:
2025-05-13 23:34:02 -07:00
parent fc9aae4235
commit 9dd7156f38

@ -432,7 +432,7 @@ impl<'a> ModelInfo<'a>{
} }
impl MapCheck<'_>{ impl MapCheck<'_>{
fn pass(self)->Result<MapInfoOwned,Self>{ fn result(self)->Result<MapInfoOwned,String>{
match self{ match self{
MapCheck{ MapCheck{
model_class:StringCheck(Ok(())), model_class:StringCheck(Ok(())),
@ -456,7 +456,7 @@ impl MapCheck<'_>{
game_id, game_id,
}) })
}, },
other=>Err(other), other=>Err(other.to_string()),
} }
} }
} }
@ -638,7 +638,7 @@ impl crate::message_handler::MessageHandler{
let map_check=model_info.check(); let map_check=model_info.check();
// check the report, generate an error message if it fails the check // check the report, generate an error message if it fails the check
let status=map_check.pass().map_err(|e|e.to_string()); let status=map_check.result();
Ok(CheckReportAndVersion{status,version}) Ok(CheckReportAndVersion{status,version})
} }