validation: update api to yield a better error
This commit is contained in:
@ -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)?;
|
||||
|
||||
|
Reference in New Issue
Block a user