Implement more persistency logic
This commit is contained in:
@ -1,12 +1,5 @@
|
||||
use crate::model::*;
|
||||
|
||||
pub enum ReplaceTextureStatus {
|
||||
// Call Again With Texture Binary
|
||||
NeedTextureData(Sha256),
|
||||
// Done.
|
||||
Ok,
|
||||
}
|
||||
|
||||
pub type ProtocolResult<T> = Result<T, ProtocolError>;
|
||||
pub enum ProtocolError {
|
||||
BadRequest(String),
|
||||
|
@ -109,6 +109,10 @@ where
|
||||
panic!("Contract Violation: handler must not return NeedTextureData \
|
||||
when data is given.");
|
||||
}
|
||||
Ok(ReplaceTextureStatus::Conflict) => {
|
||||
connection
|
||||
.send(&Package::Error(409, "Conflict".to_string()))?;
|
||||
}
|
||||
Err(err) => {
|
||||
connection.send(&Package::from(err))?;
|
||||
}
|
||||
@ -125,6 +129,9 @@ where
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(ReplaceTextureStatus::Conflict) => {
|
||||
connection.send(&Package::Error(409, "Conflict".to_string()))?;
|
||||
}
|
||||
Err(err) => {
|
||||
connection.send(&Package::from(err))?;
|
||||
}
|
||||
|
Reference in New Issue
Block a user