mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
moved tagged_list:: out of tagged_list to make it catch-able / handle add_exception / updated exception handling unidasm to match the main one and return a proper exitcode in case of an error (nw)
This commit is contained in:
parent
eb9a3ddc70
commit
82a99c4452
@ -274,6 +274,11 @@ int cli_frontend::execute(int argc, char **argv)
|
|||||||
osd_printf_error("Caught unhandled emulator exception\n");
|
osd_printf_error("Caught unhandled emulator exception\n");
|
||||||
m_result = MAMERR_FATALERROR;
|
m_result = MAMERR_FATALERROR;
|
||||||
}
|
}
|
||||||
|
catch (add_exception &aex)
|
||||||
|
{
|
||||||
|
osd_printf_error("Tag '%s' already exists in tagged_list\n", aex.tag());
|
||||||
|
m_result = MAMERR_FATALERROR;
|
||||||
|
}
|
||||||
catch (std::exception &ex)
|
catch (std::exception &ex)
|
||||||
{
|
{
|
||||||
osd_printf_error("Caught unhandled %s exception: %s\n", typeid(ex).name(), ex.what());
|
osd_printf_error("Caught unhandled %s exception: %s\n", typeid(ex).name(), ex.what());
|
||||||
|
@ -414,6 +414,11 @@ int running_machine::run(bool firstrun)
|
|||||||
osd_printf_error("Error performing a late bind of type %s to %s\n", btex.m_actual_type.name(), btex.m_target_type.name());
|
osd_printf_error("Error performing a late bind of type %s to %s\n", btex.m_actual_type.name(), btex.m_target_type.name());
|
||||||
error = MAMERR_FATALERROR;
|
error = MAMERR_FATALERROR;
|
||||||
}
|
}
|
||||||
|
catch (add_exception &aex)
|
||||||
|
{
|
||||||
|
osd_printf_error("Tag '%s' already exists in tagged_list\n", aex.tag());
|
||||||
|
error = MAMERR_FATALERROR;
|
||||||
|
}
|
||||||
catch (std::exception &ex)
|
catch (std::exception &ex)
|
||||||
{
|
{
|
||||||
osd_printf_error("Caught unhandled %s exception: %s\n", typeid(ex).name(), ex.what());
|
osd_printf_error("Caught unhandled %s exception: %s\n", typeid(ex).name(), ex.what());
|
||||||
|
@ -194,6 +194,15 @@ private:
|
|||||||
|
|
||||||
// ======================> tagged_list
|
// ======================> tagged_list
|
||||||
|
|
||||||
|
class add_exception
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
add_exception(const char *tag) : m_tag(tag) { }
|
||||||
|
const char *tag() const { return m_tag; }
|
||||||
|
private:
|
||||||
|
const char *m_tag;
|
||||||
|
};
|
||||||
|
|
||||||
// a tagged_list is a class that maintains a list of objects that can be quickly looked up by tag
|
// a tagged_list is a class that maintains a list of objects that can be quickly looked up by tag
|
||||||
template<class _ElementType>
|
template<class _ElementType>
|
||||||
class tagged_list
|
class tagged_list
|
||||||
@ -203,15 +212,6 @@ class tagged_list
|
|||||||
tagged_list &operator=(const tagged_list &);
|
tagged_list &operator=(const tagged_list &);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class add_exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
add_exception(const char *tag) : m_tag(tag) { }
|
|
||||||
const char *tag() const { return m_tag; }
|
|
||||||
private:
|
|
||||||
const char *m_tag;
|
|
||||||
};
|
|
||||||
|
|
||||||
// construction
|
// construction
|
||||||
tagged_list() { }
|
tagged_list() { }
|
||||||
|
|
||||||
|
@ -644,20 +644,29 @@ int main(int argc, char *argv[])
|
|||||||
catch (emu_fatalerror &fatal)
|
catch (emu_fatalerror &fatal)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s\n", fatal.string());
|
fprintf(stderr, "%s\n", fatal.string());
|
||||||
|
result = 1;
|
||||||
if (fatal.exitcode() != 0)
|
if (fatal.exitcode() != 0)
|
||||||
result = fatal.exitcode();
|
result = fatal.exitcode();
|
||||||
}
|
}
|
||||||
catch (emu_exception &)
|
catch (emu_exception &)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Caught unhandled emulator exception\n");
|
fprintf(stderr, "Caught unhandled emulator exception\n");
|
||||||
|
result = 1;
|
||||||
}
|
}
|
||||||
catch (std::bad_alloc &)
|
catch (add_exception &aex)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Out of memory!\n");
|
fprintf(stderr, "Tag '%s' already exists in tagged_list\n", aex.tag());
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
catch (std::exception &ex)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Caught unhandled %s exception: %s\n", typeid(ex).name(), ex.what());
|
||||||
|
result = 1;
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Caught unhandled exception\n");
|
fprintf(stderr, "Caught unhandled exception\n");
|
||||||
|
result = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
osd_free(data);
|
osd_free(data);
|
||||||
|
Loading…
Reference in New Issue
Block a user