validation: update api to yield a better error

This commit is contained in:
2025-04-08 16:11:48 -07:00
parent b93c813dec
commit 7334e88b55
6 changed files with 27 additions and 3 deletions

@ -4,6 +4,7 @@ use crate::nats_types::UploadSubmissionRequest;
#[derive(Debug)]
pub enum Error{
GetLocation(rbx_asset::cloud::GetError),
NonFreeModel,
Get(rbx_asset::cloud::GetError),
Json(serde_json::Error),
Create(rbx_asset::cookie::CreateError),
@ -25,6 +26,11 @@ impl crate::message_handler::MessageHandler{
version:upload_info.ModelVersion,
}).await.map_err(Error::GetLocation)?;
// if the location does not exist, you are not allowed to donwload it
let Some(location)=location.location else{
return Err(Error::NonFreeModel);
};
// download the map model
let model_data=self.cloud_context.get_asset(&location).await.map_err(Error::Get)?;