@@ -8,6 +8,7 @@ use crate::helpers::emojis::*;
88use crate :: lock:: LOCKFILE ;
99use crate :: queue:: FifoQueue ;
1010use crate :: queue:: * ;
11+ use anyhow:: { Context , Result } ;
1112use futures_timer:: Delay ;
1213use notify:: event:: ModifyKind ;
1314use notify:: { Config , Error , Event , EventKind , RecommendedWatcher , RecursiveMode , Watcher } ;
@@ -78,10 +79,10 @@ async fn async_watch(
7879 plain_output,
7980 warn_error,
8081 } : AsyncWatchArgs < ' _ > ,
81- ) -> notify :: Result < ( ) > {
82+ ) -> Result < ( ) > {
8283 let mut build_state: build:: build_types:: BuildCommandState =
8384 build:: initialize_build ( None , filter, show_progress, path, plain_output, warn_error)
84- . expect ( "Can't initialize build") ;
85+ . with_context ( || "Could not initialize build") ? ;
8586 let mut needs_compile_type = CompileType :: Incremental ;
8687 // create a mutex to capture if ctrl-c was pressed
8788 let ctrlc_pressed = Arc :: new ( Mutex :: new ( false ) ) ;
@@ -278,7 +279,7 @@ async fn async_watch(
278279 plain_output,
279280 build_state. get_warn_error_override ( ) ,
280281 )
281- . expect ( "Can't initialize build" ) ;
282+ . expect ( "Could not initialize build" ) ;
282283 let _ = build:: incremental_build (
283284 & mut build_state,
284285 None ,
@@ -324,7 +325,7 @@ pub fn start(
324325 create_sourcedirs : bool ,
325326 plain_output : bool ,
326327 warn_error : Option < String > ,
327- ) {
328+ ) -> Result < ( ) > {
328329 futures:: executor:: block_on ( async {
329330 let queue = Arc :: new ( FifoQueue :: < Result < Event , Error > > :: new ( ) ) ;
330331 let producer = queue. clone ( ) ;
@@ -341,7 +342,7 @@ pub fn start(
341342
342343 let path = Path :: new ( folder) ;
343344
344- if let Err ( e ) = async_watch ( AsyncWatchArgs {
345+ async_watch ( AsyncWatchArgs {
345346 q : consumer,
346347 path,
347348 show_progress,
@@ -352,8 +353,5 @@ pub fn start(
352353 warn_error : warn_error. clone ( ) ,
353354 } )
354355 . await
355- {
356- println ! ( "{e:?}" )
357- }
358356 } )
359357}
0 commit comments