Skip to content

Commit 3b4d23d

Browse files
committed
Blind shot a identifying the possible statuses a proxy_get_property could return
Signed-off-by: Alex Snaps <[email protected]>
1 parent 64712b3 commit 3b4d23d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/hostcalls.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,13 @@ pub fn get_property(path: Vec<&str>) -> Result<Option<Bytes>, Status> {
398398
let mut return_data: *mut u8 = null_mut();
399399
let mut return_size: usize = 0;
400400
unsafe {
401-
match proxy_get_property(
401+
let status = proxy_get_property(
402402
serialized_path.as_ptr(),
403403
serialized_path.len(),
404404
&mut return_data,
405405
&mut return_size,
406-
) {
406+
);
407+
match status {
407408
Status::Ok => {
408409
if !return_data.is_null() {
409410
Ok(Some(Vec::from_raw_parts(
@@ -415,8 +416,12 @@ pub fn get_property(path: Vec<&str>) -> Result<Option<Bytes>, Status> {
415416
Ok(None)
416417
}
417418
}
418-
Status::NotFound => Ok(None),
419-
status => Err(status),
419+
Status::NotFound | Status::Empty => Ok(None),
420+
Status::SerializationFailure
421+
| Status::BadArgument
422+
| Status::BadExpression
423+
| Status::Unimplemented => Err(status),
424+
status => panic!("unexpected status: {}", status as u32),
420425
}
421426
}
422427
}

0 commit comments

Comments
 (0)