[Mapbender-dev] Exception handling

Christoph Baudson (WhereGroup) christoph.baudson at wheregroup.com
Fri Apr 13 09:13:11 EDT 2007


Hello everyone,

today I added a more sophisticated exception handling to Mapbender. It 
is just a draft and may be enhanced at anytime. Please let me know if 
you think this is a sensible approach or if you have additional suggestions.

-----

Description:

check mapbender.conf. There are new constants:

define("LOG_LEVEL", "warning");

this is the log level. Choose from the following list.

define("LOG_LEVEL_LIST", "off,error,warning,all");

The list is hierarchical:

off: ignores all
error: logs errors only
warning: logs errors and warnings
all: logs errors and warnings (and maybe others in the future)

Throw an exception (as before) via

$e = new mb_exception($message);

A warning may be thrown like this

$e = new mb_warning($message);

Both classes are inherited from mb_log, which basically is the "old" 
mb_exception. For possible new types, a new class may be added easily.

For JavaScript exceptions, there are the following options

"on": via AJAX to PHP, then written in the error log file
"alert": the exception is being alerted
"console": the exception is being displayed by Firebug
"off": ignores JS exceptions

set via

define("LOG_JS", "on");

Throw it via

var e = new Mb_exception(message);
var e = new Mb_warning(message);

As each JS exception triggers an AJAX request, it might be sensible to 
consider turning them off (or use console/alert).

--
Baudson Christoph
http://www.wheregroup.com


More information about the Mapbender_dev mailing list