Skip to content

Commit bfbd0bd

Browse files
committed
[Minor] more accurate error handling
1 parent 8f7f5f3 commit bfbd0bd

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

Packer.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace ModShardPackerReference;
1414
public static class FilePacker
1515
{
1616
/// <summary>
17-
/// Pack function
17+
/// Pack the content folder into a sml file named <see cref="namePacked"/>.
1818
/// </summary>
1919
/// <param name="namePacked"></param>
2020
/// <param name="folderToPack"></param>
@@ -228,8 +228,20 @@ public static Diagnostic[] RoslynCompile(string name, IEnumerable<string> files,
228228
.Concat(neededType.Select(x => MetadataReference.CreateFromFile(x.Assembly.Location)))
229229
.Concat(GetSystemMetadataReferences());
230230
}
231-
catch
231+
catch(Exception ex)
232232
{
233+
if (ex is ArgumentNullException || ex is ArgumentException)
234+
{
235+
Log.Error(ex, "Something went wrong");
236+
}
237+
else if (ex is IOException)
238+
{
239+
Log.Error(ex, "Error with the dlls, check if they are correctly referenced.");
240+
}
241+
else
242+
{
243+
Log.Error(ex, "Unexpected error");
244+
}
233245
throw;
234246
}
235247

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
# ModShardPackerReference
1+
# ModShardPackerReference
2+
3+
The packing module for MSL and MSP.
4+
5+
## Description
6+
7+
It packs the content of a folder into a sml file.

0 commit comments

Comments
 (0)