1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-25 22:18:34 +01:00

Rethrow exceptions when no RawContentManager readers could be constructed

This commit is contained in:
Ell 2022-01-02 22:49:39 +01:00
parent 29bbd61f8b
commit b2b34abcd0
2 changed files with 9 additions and 2 deletions

View file

@ -21,6 +21,10 @@ Improvements
Improvements
- Allow for checkboxes and radio buttons to be disabled
### MLEM.Data
Improvements
- Rethrow exceptions when no RawContentManager readers could be constructed
## 5.2.0
### MLEM
Additions

View file

@ -99,6 +99,7 @@ namespace MLEM.Data.Content {
private static List<RawContentReader> CollectContentReaders() {
var ret = new List<RawContentReader>();
var assemblyExceptions = new List<Exception>();
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) {
try {
if (assembly.IsDynamic)
@ -114,10 +115,12 @@ namespace MLEM.Data.Content {
throw new NotSupportedException($"The type {type} cannot be constructed by a RawContentManager. Does it have a visible parameterless constructor?", e);
}
}
} catch {
// ignored
} catch (Exception e) {
assemblyExceptions.Add(e);
}
}
if (ret.Count <= 0)
throw new AggregateException("Failed to construct any RawContentReader instances", assemblyExceptions);
return ret;
}