M
Marvin Barley
I have a class that throws exceptions in new initializer, and a static
array of objects of this type.
When something is wrong in initialization, CGI program crashes
miserably. Debugging shows uncaught exception.
How to catch an exception that happened before main() try { ... }
catch (...) { ... } block?
Is there a way?
Thank you very much in forward,
Marvin
class formtblitem {
protected:
void clear() {
memset (form_field, 0, sizeof (form_field ));
memset (field_type, 0, sizeof (field_type ));
memset (dflt, 0, sizeof (dflt ));
memset (minval, 0, sizeof (minval ));
memset (maxval, 0, sizeof (maxval ));
memset (POVRAYsubst, 0, sizeof (POVRAYsubst));
varaddr = NULL;
}
#define STRCPY(DEST, SRC) \
if (strlen (SRC) > sizeof (DEST) - 1) \
throw PARM_ESTRBUFOVERFLOW; \
else \
strcpy (DEST, SRC);
void initialize (const char *ff, const char *ft, const char
*df,
const char *mn, const char *mx, const char
*ps) {
STRCPY (form_field, ff);
STRCPY (field_type, ft);
if (NotNull()) {
switch (FieldType()) {
case 'b':
if (!isbinary (df) || !isbinary (mn) || !
isbinary (mx))
throw PARM_EBINARY;
break;
case 'i':
if (!isinteger (df) || !isinteger (mn) || !
isinteger (mx))
throw PARM_EINTEGER;
break;
case 'f':
if (!isfloat (df) || !isfloat (mn) || !
isfloat (mx)
..
..
..
};
typedef class formtblitem FTI;
class formtblitem formtbl[] = {
// FORM field, type, dflt, min, max, POV-Ray subst
//
FTI ("debug", "b", "0", "0", "1", "DEBUG",
&debug ),
FTI ("rwidth", "i", "800", "16", "13000", "RWIDTH",
&rwidth ),
FTI ("rheight", "i", "600", "16", "13000", "RHEIGHT",
&rheight ),
FTI ("quality", "i", "9", "0", "13", "Q",
&quality ),
FTI ("antialiasing", "b", "0", "0", "1", "AA",
&antialiasing ),
..
..
..
};
array of objects of this type.
When something is wrong in initialization, CGI program crashes
miserably. Debugging shows uncaught exception.
How to catch an exception that happened before main() try { ... }
catch (...) { ... } block?
Is there a way?
Thank you very much in forward,
Marvin
class formtblitem {
protected:
void clear() {
memset (form_field, 0, sizeof (form_field ));
memset (field_type, 0, sizeof (field_type ));
memset (dflt, 0, sizeof (dflt ));
memset (minval, 0, sizeof (minval ));
memset (maxval, 0, sizeof (maxval ));
memset (POVRAYsubst, 0, sizeof (POVRAYsubst));
varaddr = NULL;
}
#define STRCPY(DEST, SRC) \
if (strlen (SRC) > sizeof (DEST) - 1) \
throw PARM_ESTRBUFOVERFLOW; \
else \
strcpy (DEST, SRC);
void initialize (const char *ff, const char *ft, const char
*df,
const char *mn, const char *mx, const char
*ps) {
STRCPY (form_field, ff);
STRCPY (field_type, ft);
if (NotNull()) {
switch (FieldType()) {
case 'b':
if (!isbinary (df) || !isbinary (mn) || !
isbinary (mx))
throw PARM_EBINARY;
break;
case 'i':
if (!isinteger (df) || !isinteger (mn) || !
isinteger (mx))
throw PARM_EINTEGER;
break;
case 'f':
if (!isfloat (df) || !isfloat (mn) || !
isfloat (mx)
..
..
..
};
typedef class formtblitem FTI;
class formtblitem formtbl[] = {
// FORM field, type, dflt, min, max, POV-Ray subst
//
FTI ("debug", "b", "0", "0", "1", "DEBUG",
&debug ),
FTI ("rwidth", "i", "800", "16", "13000", "RWIDTH",
&rwidth ),
FTI ("rheight", "i", "600", "16", "13000", "RHEIGHT",
&rheight ),
FTI ("quality", "i", "9", "0", "13", "Q",
&quality ),
FTI ("antialiasing", "b", "0", "0", "1", "AA",
&antialiasing ),
..
..
..
};