aboutsummaryrefslogtreecommitdiffstats
path: root/epan/exceptions.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-08-06 19:58:45 +0000
committerGuy Harris <guy@alum.mit.edu>2005-08-06 19:58:45 +0000
commitf618b54d368be8ee5b26c982f492d4132cda1f16 (patch)
tree4b2184339504000339e2cc5ef6405aa2320fc255 /epan/exceptions.h
parentb003633f3bc22bf99d9c1afcddb3b27ecffc9b30 (diff)
Support throwing an exception with a null message pointer, and have the
message not be const (as we generate messages with "g_strdup_sprintf()", which means they need to be freed; using a null message means that we don't have to use a special string for exceptions with no message, and don't have to worry about not freeing that). Have THROW() throw an exception with a null message pointer. (This means that you crash if you throw DissectorError with THROW(). Don't do that - it means you don't get a more detailed explanation of the dissector problem. Use the DISSECTOR_ASSERT, etc. macros in epan/proto.h instead.) Free the exception message for DissectorError, as it's mallocated. svn path=/trunk/; revision=15250
Diffstat (limited to 'epan/exceptions.h')
-rw-r--r--epan/exceptions.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/epan/exceptions.h b/epan/exceptions.h
index 355224e930..de223f4ebd 100644
--- a/epan/exceptions.h
+++ b/epan/exceptions.h
@@ -46,7 +46,13 @@
#define TypeError 3
/**
- A bug was detected in a dissector
+ A bug was detected in a dissector.
+
+ DO NOT throw this with THROW(); the handler expects there to be a
+ message, and even if it didn't, the developers expect there to be
+ a message to make it easier to figure out what the problem is.
+
+ Instead, use the DISSECTOR_ASSERT(), etc. macros in epan/proto.h.
**/
#define DissectorError 4
@@ -195,7 +201,7 @@
/* user's code goes here */
#define THROW(x) \
- except_throw(XCEPT_GROUP_ETHEREAL, (x), "XCEPT_GROUP_ETHEREAL")
+ except_throw(XCEPT_GROUP_ETHEREAL, (x), NULL)
#define THROW_MESSAGE(x, y) \
except_throw(XCEPT_GROUP_ETHEREAL, (x), (y))