Create and use InvalidFirmwarePackageException

This commit is contained in:
Thog 2020-01-09 20:42:43 +01:00
parent dffd92483f
commit 070f4ee122
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6
2 changed files with 17 additions and 8 deletions

View file

@ -0,0 +1,9 @@
using System;
namespace Ryujinx.HLE.Exceptions
{
class InvalidFirmwarePackageException : Exception
{
public InvalidFirmwarePackageException(string message) : base(message) { }
}
}

View file

@ -1,10 +1,9 @@
using LibHac;
using LibHac.Fs;
using LibHac.FsService;
using LibHac.FsSystem;
using LibHac.FsSystem.NcaUtils;
using LibHac.Ncm;
using Ryujinx.HLE.HOS.Font;
using Ryujinx.HLE.Exceptions;
using Ryujinx.HLE.HOS.Services.Time;
using Ryujinx.HLE.Utilities;
using System;
@ -13,8 +12,6 @@ using System.IO;
using System.IO.Compression;
using System.Linq;
using static Ryujinx.Common.HexUtils;
namespace Ryujinx.HLE.FileSystem.Content
{
internal class ContentManager
@ -367,7 +364,7 @@ namespace Ryujinx.HLE.FileSystem.Content
InstallFromCart(xci, temporaryDirectory);
break;
default:
throw new FormatException("Input file is not a valid firmware package");
throw new InvalidFirmwarePackageException("Input file is not a valid firmware package");
}
FinishInstallation(temporaryDirectory, registeredDirectory);
@ -523,7 +520,10 @@ namespace Ryujinx.HLE.FileSystem.Content
return VerifyAndGetVersion(partition);
}
else
throw new InvalidDataException("Update not found in xci file.");
{
throw new InvalidFirmwarePackageException("Update not found in xci file.");
}
default:
break;
}
@ -684,7 +684,7 @@ namespace Ryujinx.HLE.FileSystem.Content
}
}
throw new InvalidDataException($"Firmware package contains unrelated archives. Please remove these paths: \n{extraNcas}");
throw new InvalidFirmwarePackageException($"Firmware package contains unrelated archives. Please remove these paths: \n{extraNcas}");
}
}
else
@ -815,7 +815,7 @@ namespace Ryujinx.HLE.FileSystem.Content
}
}
throw new InvalidDataException($"Firmware package contains unrelated archives. Please remove these paths: \n{extraNcas}");
throw new InvalidFirmwarePackageException($"Firmware package contains unrelated archives. Please remove these paths: \n{extraNcas}");
}
return systemVersion;