22 * License, v. 2.0. If a copy of the MPL was not distributed with this
33 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44
5- use crate :: statecallback:: StateCallback ;
6- use runloop:: RunLoop ;
7-
5+ use crate :: errors;
86use crate :: platform:: fd:: Fd ;
97use crate :: platform:: monitor:: Monitor ;
8+ use crate :: statecallback:: StateCallback ;
9+ use runloop:: RunLoop ;
1010
1111pub struct Transaction {
1212 // Handle to the thread loop.
@@ -16,9 +16,9 @@ pub struct Transaction {
1616impl Transaction {
1717 pub fn new < F , T > (
1818 timeout : u64 ,
19- callback : StateCallback < Result < T , crate :: Error > > ,
19+ callback : StateCallback < crate :: Result < T > > ,
2020 new_device_cb : F ,
21- ) -> Result < Self , crate :: Error >
21+ ) -> crate :: Result < Self >
2222 where
2323 F : Fn ( Fd , & dyn Fn ( ) -> bool ) + Sync + Send + ' static ,
2424 T : ' static ,
@@ -30,14 +30,16 @@ impl Transaction {
3030
3131 // Start polling for new devices.
3232 try_or ! ( monitor. run( alive) , |_| callback
33- . call( Err ( crate :: Error :: Unknown ) ) ) ;
33+ . call( Err ( errors :: AuthenticatorError :: Platform ) ) ) ;
3434
3535 // Send an error, if the callback wasn't called already.
36- callback. call ( Err ( crate :: Error :: NotAllowed ) ) ;
36+ callback. call ( Err ( errors:: AuthenticatorError :: U2FToken (
37+ errors:: U2FTokenError :: NotAllowed ,
38+ ) ) ) ;
3739 } ,
3840 timeout,
3941 )
40- . map_err ( |_| crate :: Error :: Unknown ) ?;
42+ . map_err ( |_| errors :: AuthenticatorError :: Platform ) ?;
4143
4244 Ok ( Self {
4345 thread : Some ( thread) ,
0 commit comments