Обработка исключений

#include <iostream>
#include <stdexcept>
#include <vector>
using namespace std;

void throwWhenNullOrEmpty(vector<intlist)
{
    class IsEmptyException : exception { };
    class NotEnoughException : exception { };

    if (list.size() == 0) {
        throw IsEmptyException();
    }
    if (list.size() < 10) {
        throw NotEnoughException();
    }
}

try {
    throwWhenNullOrEmpty({123});
}
catch (...) {
    cout << "Error happened";
}