cloud: change error names

This commit is contained in:
Quaternions 2024-08-16 17:22:28 -07:00
parent eecb1b3679
commit 99f62d090b

View File

@ -15,8 +15,8 @@ pub struct CreateAssetRequest{
} }
#[derive(Debug)] #[derive(Debug)]
pub enum CreateError{ pub enum CreateError{
ParseError(url::ParseError), Parse(url::ParseError),
SerializeError(serde_json::Error), Serialize(serde_json::Error),
Reqwest(reqwest::Error), Reqwest(reqwest::Error),
} }
impl std::fmt::Display for CreateError{ impl std::fmt::Display for CreateError{
@ -298,9 +298,9 @@ impl CloudContext{
.send().await .send().await
} }
pub async fn create_asset(&self,config:CreateAssetRequest,body:impl Into<std::borrow::Cow<'static,[u8]>>)->Result<RobloxOperation,CreateError>{ pub async fn create_asset(&self,config:CreateAssetRequest,body:impl Into<std::borrow::Cow<'static,[u8]>>)->Result<RobloxOperation,CreateError>{
let url=reqwest::Url::parse("https://apis.roblox.com/assets/v1/assets").map_err(CreateError::ParseError)?; let url=reqwest::Url::parse("https://apis.roblox.com/assets/v1/assets").map_err(CreateError::Parse)?;
let request_config=serde_json::to_string(&config).map_err(CreateError::SerializeError)?; let request_config=serde_json::to_string(&config).map_err(CreateError::Serialize)?;
let part=reqwest::multipart::Part::bytes(body) let part=reqwest::multipart::Part::bytes(body)
//you must have a file name or roblox will 400!!!!!!!!! //you must have a file name or roblox will 400!!!!!!!!!