Browse files

There are certain error and warning messages on which we do not want

back-traces to be printed. This patch modifies error list generation
code, so a new properly 'show_bt' can be defined to inhibit the bt.

git-svn-id: svn://cherokee-project.com/cherokee/trunk@5804 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information...
1 parent 186536c commit 75e0bef5063d97342b14fa96a58fb76986aa4184 @alobbs alobbs committed Nov 22, 2010
Showing with 26 additions and 16 deletions.
  1. +8 −6 cherokee/error_list.py
  2. +10 −6 cherokee/error_log.c
  3. +1 −0 cherokee/error_log.h
  4. +7 −4 cherokee/errors.py
View
14 cherokee/error_list.py
@@ -34,10 +34,11 @@
# cherokee/rrd_tools.c
#
e('RRD_NO_BINARY',
- title = "Could not find the rrdtool binary.",
- desc = "A custom rrdtool binary has not been defined, and the server could not find one in the $PATH.",
- debug = "PATH=%s",
- admin = '/general#tabs_general-0')
+ title = "Could not find the rrdtool binary.",
+ desc = "A custom rrdtool binary has not been defined, and the server could not find one in the $PATH.",
+ debug = "PATH=%s",
+ admin = '/general#tabs_general-0',
+ show_bt = False)
e('RRD_EXECV',
title = "execv failed cmd='%s': ${errno}",
@@ -727,8 +728,9 @@
# cherokee/config_reader.c
#
e('CONF_READ_ACCESS_FILE',
- title = "Could not access file",
- desc = "The configuration file '%s' could not be accessed. Most probably the server user does not have enough permissions to read it.")
+ title = "Could not access file",
+ desc = "The configuration file '%s' could not be accessed. Most probably the server user does not have enough permissions to read it.",
+ show_bt = False)
e('CONF_READ_CHILDREN_SAME_NODE',
title = "'%s' and '%s' as child of the same node",
View
16 cherokee/error_log.c
@@ -209,13 +209,15 @@ render_python_error (cherokee_error_type_t type,
cherokee_buffer_add_str (output, "\", ");
/* Backtrace */
- cherokee_buffer_add_str (output, "'backtrace': \"");
+ if (error->show_backtrace) {
+ cherokee_buffer_add_str (output, "'backtrace': \"");
#ifdef BACKTRACES_ENABLED
- cherokee_buffer_clean (&tmp);
- cherokee_buf_add_backtrace (&tmp, 2, "\\n", "");
- cherokee_buffer_add_escape_html (output, &tmp);
+ cherokee_buffer_clean (&tmp);
+ cherokee_buf_add_backtrace (&tmp, 2, "\\n", "");
+ cherokee_buffer_add_escape_html (output, &tmp);
#endif
- cherokee_buffer_add_str (output, "\", ");
+ cherokee_buffer_add_str (output, "\", ");
+ }
/* Let's finish here.. */
if (strcmp (output->buf + output->len - 2, ", ") == 0) {
@@ -268,7 +270,9 @@ render_human_error (cherokee_error_type_t type,
/* Backtrace */
#ifdef BACKTRACES_ENABLED
- cherokee_buf_add_backtrace (output, 2, "\n", " ");
+ if (error->show_backtrace) {
+ cherokee_buf_add_backtrace (output, 2, "\n", " ");
+ }
#endif
}
View
1 cherokee/error_log.h
@@ -45,6 +45,7 @@ typedef struct {
const char *description;
const char *admin_url;
const char *debug;
+ int show_backtrace;
} cherokee_error_t;
#define CHEROKEE_ERROR(x) ((cherokee_error_t *)(x))
View
11 cherokee/errors.py
@@ -23,6 +23,7 @@ def __init__ (self, **kwargs):
self.url_admin = kwargs.get('admin', '')
self.help = kwargs.get('help', [])
self.debug = kwargs.get('debug', '')
+ self.show_bt = kwargs.get('show_bt', True)
_errors = []
@@ -177,7 +178,7 @@ def check_parameters (dirs):
* 02110-1301, USA.
*/
-/* NOTE: File automatically generated (from error_list.py). */
+/* NOTE: File automatically generated (by error_list.py). */
"""
@@ -212,12 +213,14 @@ def generate_C_errors ():
txt += 'NULL, '
if err.debug:
- txt += '"%s"' % (err.debug)
+ txt += '"%s", ' % (err.debug)
else:
- txt += 'NULL'
+ txt += 'NULL, '
+
+ txt += ('false', 'true')[err.show_bt]
txt += ' },\n'
- txt += ' { -1, NULL, NULL, NULL, NULL}\n'
+ txt += ' { -1, NULL, NULL, NULL, NULL, true }\n'
txt += '};\n'
return txt

0 comments on commit 75e0bef

Please sign in to comment.