P
pazabo
Hi,
I'm trying to create a class "Exception" that will contain some
enumeration specifying cause (why the exception was thrown):
class Exception {
public:
enum Type {
DATABASE_CORRUPTED,
COULD_NOT_READ_TABLE_MAP
} type;
explicit Exception(Type type) : type(type) {}
};
But I don't really know how does the compiler understand:
throw Exception::COULD_NOT_READ_TABLE_MAP
because it doesn't show any errors or even warnings, and
COULD_NOT_READ_TABLE_MAP is not a member of Exception class. Does
anybody know how can this be correct ? Also I would be greatful if you
would share with me your experiences with C++ exceptions (do you create
a class for every situation or do you try to do it like I do / how do
you organize them).
Paul PAZABO Zaborski
I'm trying to create a class "Exception" that will contain some
enumeration specifying cause (why the exception was thrown):
class Exception {
public:
enum Type {
DATABASE_CORRUPTED,
COULD_NOT_READ_TABLE_MAP
} type;
explicit Exception(Type type) : type(type) {}
};
But I don't really know how does the compiler understand:
throw Exception::COULD_NOT_READ_TABLE_MAP
because it doesn't show any errors or even warnings, and
COULD_NOT_READ_TABLE_MAP is not a member of Exception class. Does
anybody know how can this be correct ? Also I would be greatful if you
would share with me your experiences with C++ exceptions (do you create
a class for every situation or do you try to do it like I do / how do
you organize them).
Paul PAZABO Zaborski