[Mapserver-dev] Error stack system

Daniel Morissette morissette at dmsolutions.ca
Thu Jan 9 14:48:20 EST 2003


I would like to start discussing a potential improvement to error
reporting in MapServer.

In the current implementation, if multiple functions call msSetError()
at multiple levels in the call stack, it is only the message from the
last msSetError() call that is reported.  This results in situations
like "msDrawMap() failed" but you don't know why because the lower-level
error has been overwritten by the more generic message.

Of course one can use logfiles to debug the problem, but I'm looking for
a way to allow MapScript applications to do better error handling.  The
specific case that I have to deal with now is drawing a map that
contains WMS/WFS layers.

Imagine a map with 10 layers, 5 shapefile layers and 5 WMS layers.  When
we do a call to $map->draw(), one of the WMS layers may timeout, or
another one might point to a server that is not available any more (404
error) and I would like to provide a mean to trap this in MapScript and
report the problems to the user while still showing a map with the
layers that did work.

One of the ways to achieve this could be to set a kind of error_status
flag (or error_code and error_message metadata???) in every layer in the
map, and after the call to $map->draw() we could loop through the
layers, check their error_status and take action.

The other option would be to modify the error handling in MapServer to
accumulate the error messages in a stack when msSetError() is called
multiple times and provice a function via MapScript to loop through the
error stack.  The main benefit of this is not for WMS, but for the more
general case: when reporting errors, MapServer would report all errors
in the stack and not just the last error.

I am looking for comments on what other developers think is best.  I
think the layer-based error_code/error_message metadata would be better
to solve the current WMS/WFS $map->draw() problems, but OTOH an error
stack system would benefit to the rest of MapServer.

Comments, thoughts?

 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/

More information about the mapserver-dev mailing list