#include <exception>

typedef enum foo_Result {
    FOO_OK,
    FOO_ERROR1,
    FOO_ERROR2,
    FOO_UNKNOWN
} foo_Result;

struct MyException1 { };
struct MyException2 { };

foo_Result lippincott()
try
{
    try
    {
        if (std::exception_ptr eptr = std::current_exception())
        {
            std::rethrow_exception(eptr);
        }
        else
        {
            return FOO_UNKNOWN;
        }
    }
    catch (const MyException1&)
    {
        return FOO_ERROR1;
    }
    catch (const MyException2&)
    {
        return FOO_ERROR2;
    }
    catch (...)
    {
        return FOO_UNKNOWN;
    }
}
catch (...)
{
    return FOO_UNKNOWN;
}

//////////////////////////

void Snafuscate(bool andDie)
{
	if (andDie)
	{
		throw MyException1();
	}
}

foo_Result foo_snafuscate(bool andDie)
{
	try
	{
		Snafuscate(andDie);
		return FOO_OK;
	}
	catch (...)
	{
		return lippincott();
	}
}

#include <iostream>

int main()
{
	foo_Result r1 = foo_snafuscate(false);
	if (r1 == FOO_OK) std::cout << "r1 == FOO_OK\n";
	
	foo_Result r2 = foo_snafuscate(true);
	if (r2 != FOO_OK) std::cout << "r2 != FOO_OK (r2 == " << r2 << ")\n";
}