@@ -64,15 +64,33 @@ await Parallel.ForEachAsync(AssetIndex,
6464
6565 return ;
6666
67- ValueTask Impl ( FilePropertiesRemote asset , CancellationToken token )
67+ async ValueTask Impl ( FilePropertiesRemote asset , CancellationToken token )
6868 {
69- return asset switch
69+ try
7070 {
71- { AssociatedObject : SophonAsset } => RepairAssetGenericSophonType ( asset , token ) ,
72- { FT : FileType . Audio } => RepairAssetAudioType ( asset , token ) ,
73- { FT : FileType . Block } => RepairAssetBlockType ( asset , token ) ,
74- _ => RepairAssetGenericType ( GetHttpClientFromFilename ( asset ) , asset , token )
75- } ;
71+ await ( asset switch
72+ {
73+ { AssociatedObject : SophonAsset } => RepairAssetGenericSophonType ( asset , token ) . ConfigureAwait ( false ) ,
74+ { FT : FileType . Audio } => RepairAssetAudioType ( asset , token ) . ConfigureAwait ( false ) ,
75+ { FT : FileType . Block } => RepairAssetBlockType ( asset , token ) . ConfigureAwait ( false ) ,
76+ _ => RepairAssetGenericType ( GetHttpClientFromFilename ( asset ) , asset , token ) . ConfigureAwait ( false )
77+ } ) ;
78+ }
79+ catch ( HttpRequestException httpEx )
80+ {
81+ string message = "An HTTP error has occurred while trying to download this following asset:" +
82+ $ """
83+ Asset Path: { asset . N }
84+ Asset Remote URL: { asset . RN }
85+ Asset Size: { asset . S }
86+ Asset Hash: { asset . CRC }
87+ Type: { asset . FT }
88+ Object Association: { ( asset . AssociatedObject is var obj ? obj . GetType ( ) . Name : "GenericDownload" ) }
89+ HTTP Status code: { httpEx . StatusCode } ({ ( int ) ( httpEx . StatusCode ?? default ) } )
90+ HTTP Error category: { httpEx . HttpRequestError }
91+ """ ;
92+ throw new HttpRequestException ( httpEx . HttpRequestError , message , httpEx , httpEx . StatusCode ) ;
93+ }
7694 }
7795
7896 HttpClient GetHttpClientFromFilename ( FilePropertiesRemote asset )
0 commit comments