@@ -196,12 +196,8 @@ async fn import_bytes_tiny_impl(
196196 let size = cmd. data . len ( ) as u64 ;
197197 // send the required progress events
198198 // AddProgressItem::Done will be sent when finishing the import!
199- tx. send ( AddProgressItem :: Size ( size) )
200- . await
201- . map_err ( |_e| io:: Error :: other ( "error" ) ) ?;
202- tx. send ( AddProgressItem :: CopyDone )
203- . await
204- . map_err ( |_e| io:: Error :: other ( "error" ) ) ?;
199+ tx. send ( AddProgressItem :: Size ( size) ) . await ?;
200+ tx. send ( AddProgressItem :: CopyDone ) . await ?;
205201 Ok ( if raw_outboard_size ( size) == 0 {
206202 // the thing is so small that it does not even need an outboard
207203 ImportEntry {
@@ -286,12 +282,8 @@ async fn import_byte_stream_impl(
286282) -> io:: Result < ImportEntry > {
287283 let ImportByteStreamRequest { format, scope } = cmd;
288284 let import_source = get_import_source ( stream, tx, & options) . await ?;
289- tx. send ( AddProgressItem :: Size ( import_source. size ( ) ) )
290- . await
291- . map_err ( |_e| io:: Error :: other ( "error" ) ) ?;
292- tx. send ( AddProgressItem :: CopyDone )
293- . await
294- . map_err ( |_e| io:: Error :: other ( "error" ) ) ?;
285+ tx. send ( AddProgressItem :: Size ( import_source. size ( ) ) ) . await ?;
286+ tx. send ( AddProgressItem :: CopyDone ) . await ?;
295287 compute_outboard ( import_source, format, scope, options, tx) . await
296288}
297289
@@ -344,18 +336,14 @@ async fn get_import_source(
344336 data. extend_from_slice ( & chunk) ;
345337 }
346338 // todo: don't send progress for every chunk if the chunks are small?
347- tx. try_send ( AddProgressItem :: CopyProgress ( size) )
348- . await
349- . map_err ( |_e| io:: Error :: other ( "error" ) ) ?;
339+ tx. try_send ( AddProgressItem :: CopyProgress ( size) ) . await ?;
350340 }
351341 Ok ( if let Some ( ( mut file, temp_path) ) = disk {
352342 while let Some ( chunk) = stream. next ( ) . await {
353343 let chunk = chunk?;
354344 file. write_all ( & chunk) ?;
355345 size += chunk. len ( ) as u64 ;
356- tx. send ( AddProgressItem :: CopyProgress ( size) )
357- . await
358- . map_err ( |_e| io:: Error :: other ( "error" ) ) ?;
346+ tx. send ( AddProgressItem :: CopyProgress ( size) ) . await ?;
359347 }
360348 ImportSource :: TempFile ( temp_path, file, size)
361349 } else {
@@ -473,14 +461,10 @@ async fn import_path_impl(
473461 }
474462
475463 let size = path. metadata ( ) ?. len ( ) ;
476- tx. send ( AddProgressItem :: Size ( size) )
477- . await
478- . map_err ( |_e| io:: Error :: other ( "error" ) ) ?;
464+ tx. send ( AddProgressItem :: Size ( size) ) . await ?;
479465 let import_source = if size <= options. inline . max_data_inlined {
480466 let data = std:: fs:: read ( path) ?;
481- tx. send ( AddProgressItem :: CopyDone )
482- . await
483- . map_err ( |_e| io:: Error :: other ( "error" ) ) ?;
467+ tx. send ( AddProgressItem :: CopyDone ) . await ?;
484468 ImportSource :: Memory ( data. into ( ) )
485469 } else if mode == ImportMode :: TryReference {
486470 // reference where it is. We are going to need the file handle to
@@ -500,9 +484,7 @@ async fn import_path_impl(
500484 ) ;
501485 // copy from path to temp_path
502486 let file = OpenOptions :: new ( ) . read ( true ) . open ( & temp_path) ?;
503- tx. send ( AddProgressItem :: CopyDone )
504- . await
505- . map_err ( |_| io:: Error :: other ( "error" ) ) ?;
487+ tx. send ( AddProgressItem :: CopyDone ) . await ?;
506488 ImportSource :: TempFile ( temp_path, file, size)
507489 } ;
508490 compute_outboard ( import_source, format, batch, options, tx) . await
0 commit comments