[mapserver-dev] [Fwd: [mapserver-users] maperror.h - MESSAGELENGTH isnt long enough for my messages]

Daniel Morissette morissette at dmsolutions.ca
Sat Nov 16 13:52:26 EST 2002


David Blasby wrote:
> 
> I've been having trouble figuring out why I kept crashing mapserver.
> The problem is that the maximum size of the error message to return is
> 2k, and my error message is a bit longer.  In order to be more helpful
> (and quit answering the same questions) the postgis error message send
> back the user manal.
> 
> Anyone mind if I up this to 4k? and the ROUTINELENGTH to a larger value
> too?  I dont think we're allocating more than one so it shouldnt cause
> any problems down the road.
> 
> Either that or have msSetError(...) use vsnprintf() instead of just
> vsprintf().
> 

I agree that using vsnprintf() would be a good idea in order to prevent
further problems.

About increasing the buffer size, I don't think that's the right
solution.  I mean a 2k long error message is likely to cause problems in
other places (at the application level) and I don't think an error
message is the right place to include the full user manual anyway.

How about changing your error message to point the user to the URL where
the docs can be found?  I've seen this and even done that myself in
other places.  For instance in PHP MapScript I test if we're running in
CGI mode, and if not then I output the following message that points the
user to the Wiki for the long story:

  php3_error(E_ERROR, 
     "Due to thread-safety problems, php_mapscript cannot be used "
     "as a '%s' module.  You will have to reconfigure your PHP as "
     "a CGI to run this version of MapScript. \n"
     "See <a
href=\"http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptCGI\">
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptCGI</a>.\n",
             sapi_module.name);


After reading this, if the user doesn't take the time to go visit the
URL and dares to send a question that was answered in that page then I
would simply hit delete and not not even bother sending an RTFMS reply.

My 0.02$.

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



More information about the mapserver-dev mailing list