ivila commented on code in PR #221:
URL: 
https://github.com/apache/incubator-teaclave-trustzone-sdk/pull/221#discussion_r2281194989


##########
examples/tls_server-rs/ta/src/main.rs:
##########
@@ -63,104 +65,183 @@ fn invoke_command(cmd_id: u32, params: &mut Parameters) 
-> Result<()> {
     match Command::from(cmd_id) {
         Command::NewTlsSession => {
             trace_println!("[+] new_tls_session");
-            new_tls_session(session_id);
-            Ok(())
+            match new_tls_session(session_id) {
+                Ok(_) => Ok(()),
+                Err(e) => {
+                    trace_println!("[-] Failed to create TLS session: {:?}", 
e);
+                    Err(Error::new(ErrorKind::Generic))
+                }
+            }
         }
         Command::DoTlsRead => {
             let mut p1 = unsafe { params.1.as_memref().unwrap() };
             let buffer = p1.buffer();
             trace_println!("[+] do_tls_read");
-            do_tls_read(session_id, buffer);
-            Ok(())
+            match do_tls_read(session_id, buffer) {
+                Ok(_) => Ok(()),
+                Err(e) => {
+                    trace_println!("[-] Failed to read TLS data: {:?}", e);
+                    Err(Error::new(ErrorKind::Generic))
+                }
+            }
         }
         Command::DoTlsWrite => {
             trace_println!("[+] do_tls_write");
             let mut p1 = unsafe { params.1.as_memref().unwrap() };
             let mut p2 = unsafe { params.2.as_value().unwrap() };

Review Comment:
   Can we remove the `unwrap` here?



-- 
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]

Reply via email to