DemesneGH commented on code in PR #278:
URL:
https://github.com/apache/teaclave-trustzone-sdk/pull/278#discussion_r2801940668
##########
optee-utee/src/parameter.rs:
##########
@@ -185,3 +306,101 @@ impl From<u32> for ParamType {
}
}
}
+
+#[derive(Debug)]
+pub struct BiggerThanCapacityErr {
+ requested_size: usize,
+ capacity: usize,
+}
+
+impl Display for BiggerThanCapacityErr {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+ write!(
+ f,
+ "requested size {} but this is bigger than the capacity {}",
+ self.requested_size, self.capacity,
+ )
+ }
+}
+
+impl CoreError for BiggerThanCapacityErr {}
+
+impl From<BiggerThanCapacityErr> for crate::Error {
+ fn from(_value: BiggerThanCapacityErr) -> Self {
+ crate::Error::new(ErrorKind::Overflow)
+ }
+}
Review Comment:
Sounds good, thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]