@@ -11,6 +11,7 @@ use std::vec;
1111use std:: { io, string, thread} ;
1212
1313use crate :: authenticatorservice:: AuthenticatorTransport ;
14+ use crate :: errors;
1415use crate :: statecallback:: StateCallback ;
1516use crate :: virtualdevices:: webdriver:: { testtoken, web_api} ;
1617
@@ -66,11 +67,13 @@ impl AuthenticatorTransport for VirtualManager {
6667 _application : crate :: AppId ,
6768 _key_handles : Vec < crate :: KeyHandle > ,
6869 _status : Sender < crate :: StatusUpdate > ,
69- callback : StateCallback < Result < crate :: RegisterResult , crate :: Error > > ,
70- ) -> Result < ( ) , crate :: Error > {
70+ callback : StateCallback < crate :: Result < crate :: RegisterResult > > ,
71+ ) -> crate :: Result < ( ) > {
7172 if self . rloop . is_some ( ) {
7273 error ! ( "WebDriver state error, prior operation never cancelled." ) ;
73- return Err ( crate :: Error :: Unknown ) ;
74+ return Err ( errors:: AuthenticatorError :: U2FToken (
75+ errors:: U2FTokenError :: Unknown ,
76+ ) ) ;
7477 }
7578
7679 let state = self . state . clone ( ) ;
@@ -93,7 +96,7 @@ impl AuthenticatorTransport for VirtualManager {
9396 } ,
9497 timeout
9598 ) ,
96- |_| Err ( crate :: Error :: Unknown )
99+ |_| Err ( errors :: AuthenticatorError :: Platform )
97100 ) ;
98101
99102 self . rloop = Some ( rloop) ;
@@ -108,11 +111,13 @@ impl AuthenticatorTransport for VirtualManager {
108111 _app_ids : Vec < crate :: AppId > ,
109112 _key_handles : Vec < crate :: KeyHandle > ,
110113 _status : Sender < crate :: StatusUpdate > ,
111- callback : StateCallback < Result < crate :: SignResult , crate :: Error > > ,
112- ) -> Result < ( ) , crate :: Error > {
114+ callback : StateCallback < crate :: Result < crate :: SignResult > > ,
115+ ) -> crate :: Result < ( ) > {
113116 if self . rloop . is_some ( ) {
114117 error ! ( "WebDriver state error, prior operation never cancelled." ) ;
115- return Err ( crate :: Error :: Unknown ) ;
118+ return Err ( errors:: AuthenticatorError :: U2FToken (
119+ errors:: U2FTokenError :: Unknown ,
120+ ) ) ;
116121 }
117122
118123 let state = self . state . clone ( ) ;
@@ -135,14 +140,14 @@ impl AuthenticatorTransport for VirtualManager {
135140 } ,
136141 timeout
137142 ) ,
138- |_| Err ( crate :: Error :: Unknown )
143+ |_| Err ( errors :: AuthenticatorError :: Platform )
139144 ) ;
140145
141146 self . rloop = Some ( rloop) ;
142147 Ok ( ( ) )
143148 }
144149
145- fn cancel ( & mut self ) -> Result < ( ) , crate :: Error > {
150+ fn cancel ( & mut self ) -> crate :: Result < ( ) > {
146151 if let Some ( r) = self . rloop . take ( ) {
147152 debug ! ( "WebDriver operation cancelled." ) ;
148153 r. cancel ( ) ;
0 commit comments