mirror of https://github.com/stella-emu/stella.git
Refactoring.
This commit is contained in:
parent
7386424ccc
commit
c581fd7be3
|
@ -101,7 +101,7 @@ CartridgeELF::CartridgeELF(const ByteBuffer& image, size_t size, string_view md5
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
elfParser.parse(image.get(), size);
|
elfParser.parse(image.get(), size);
|
||||||
} catch (ElfParser::EInvalidElf& e) {
|
} catch (ElfParser::ElfParseError& e) {
|
||||||
throw runtime_error("failed to initialize ELF: " + string(e.what()));
|
throw runtime_error("failed to initialize ELF: " + string(e.what()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,18 +24,18 @@
|
||||||
|
|
||||||
class ElfParser {
|
class ElfParser {
|
||||||
public:
|
public:
|
||||||
class EInvalidElf : public std::exception {
|
class ElfParseError : public std::exception {
|
||||||
friend ElfParser;
|
friend ElfParser;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const char* what() const noexcept override { return myReason.c_str(); }
|
const char* what() const noexcept override { return myReason.c_str(); }
|
||||||
|
|
||||||
[[noreturn]] static void raise(string_view message) {
|
[[noreturn]] static void raise(string_view message) {
|
||||||
throw EInvalidElf(message);
|
throw ElfParseError(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit EInvalidElf(string_view reason) : myReason(reason) {}
|
explicit ElfParseError(string_view reason) : myReason(reason) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const string myReason;
|
const string myReason;
|
||||||
|
|
Loading…
Reference in New Issue