@@ -162,24 +162,33 @@ pub enum IntegrationError {
162
162
RepakError { source : repak:: Error } ,
163
163
#[ snafu( transparent) ]
164
164
UnrealAssetError { source : unreal_asset:: Error } ,
165
- #[ snafu( display( "mod {}: I/O error encountered during its processing" , mod_info. name) ) ]
165
+ #[ snafu( display( "mod {:? }: I/O error encountered during its processing" , mod_info. name) ) ]
166
166
CtxtIoError {
167
167
source : std:: io:: Error ,
168
168
mod_info : ModInfo ,
169
169
} ,
170
- #[ snafu( display( "mod {}: repak error encountered during its processing" , mod_info. name) ) ]
170
+ #[ snafu( display( "mod {:? }: repak error encountered during its processing" , mod_info. name) ) ]
171
171
CtxtRepakError {
172
172
source : repak:: Error ,
173
173
mod_info : ModInfo ,
174
174
} ,
175
175
#[ snafu( display(
176
- "modfile {} of mod {mod_info:?} contains unexpected prefix" ,
176
+ "mod {:?}: modfile {} contains unexpected prefix" ,
177
+ mod_info. name,
177
178
modfile_path
178
179
) ) ]
179
180
ModfileInvalidPrefix {
180
181
mod_info : ModInfo ,
181
182
modfile_path : String ,
182
183
} ,
184
+ #[ snafu( display(
185
+ "mod {:?}: failed to integrate: {source}" ,
186
+ mod_info. name,
187
+ ) ) ]
188
+ CtxtGenericError {
189
+ source : Box < dyn std:: error:: Error + Send + Sync > ,
190
+ mod_info : ModInfo ,
191
+ } ,
183
192
#[ snafu( transparent) ]
184
193
ProviderError { source : ProviderError } ,
185
194
#[ snafu( display( "integration error: {msg}" ) ) ]
@@ -199,6 +208,7 @@ impl IntegrationError {
199
208
match self {
200
209
IntegrationError :: CtxtIoError { mod_info, .. }
201
210
| IntegrationError :: CtxtRepakError { mod_info, .. }
211
+ | IntegrationError :: CtxtGenericError { mod_info, .. }
202
212
| IntegrationError :: ModfileInvalidPrefix { mod_info, .. } => mod_info. modio_id ,
203
213
IntegrationError :: ProviderError { source } => source. opt_mod_id ( ) ,
204
214
_ => None ,
@@ -382,7 +392,10 @@ pub fn integrate<P: AsRef<Path>>(
382
392
. build ( ) ?;
383
393
asset_registry
384
394
. populate ( normalized. with_extension ( "" ) . as_str ( ) , & asset)
385
- . map_err ( |e| IntegrationError :: GenericError { msg : e. to_string ( ) } ) ?;
395
+ . map_err ( |e| IntegrationError :: CtxtGenericError {
396
+ source : e. into ( ) ,
397
+ mod_info : mod_info. clone ( ) ,
398
+ } ) ?;
386
399
}
387
400
_ => { }
388
401
}
0 commit comments