[mapserver-commits] r13193 - trunk/mapserver/mapcache/lib

svn at osgeo.org svn at osgeo.org
Thu Mar 1 22:59:48 EST 2012


Author: hobu
Date: 2012-03-01 19:59:47 -0800 (Thu, 01 Mar 2012)
New Revision: 13193

Modified:
   trunk/mapserver/mapcache/lib/source_mapserver.c
Log:
mapcache: add some more detailed error reporting #4219

Modified: trunk/mapserver/mapcache/lib/source_mapserver.c
===================================================================
--- trunk/mapserver/mapcache/lib/source_mapserver.c	2012-03-01 19:17:53 UTC (rev 13192)
+++ trunk/mapserver/mapcache/lib/source_mapserver.c	2012-03-02 03:59:47 UTC (rev 13193)
@@ -42,6 +42,8 @@
 void _mapcache_source_mapserver_render_map(mapcache_context *ctx, mapcache_map *map) {
    mapcache_source_mapserver *mapserver = (mapcache_source_mapserver*)map->tileset->source;
    static mapObj *origmap = NULL;
+   errorObj *errors = NULL;
+   
    if(!origmap) {
       msSetup();
       origmap = msLoadMap(mapserver->mapfile,NULL);
@@ -49,13 +51,23 @@
    }
    if(!origmap) {
       msWriteError(stderr);
-      ctx->set_error(ctx,500,"failed to load mapfile %s",mapserver->mapfile);
+      errors = msGetErrorObj();
+      char* msg = (char*) msSmallMalloc(MESSAGELENGTH+1);
+      msg = msStrdup(errors->message);
+
+      msFree(msg);
+      ctx->set_error(ctx,500,"Failed to load mapfile '%s'. Mapserver reports: ",mapserver->mapfile, msg);
       return;
    }
    mapObj *omap = msNewMapObj();
    msCopyMap(omap,origmap);
    if (msLoadProjectionString(&(omap->projection), map->grid_link->grid->srs) != 0) {
-      ctx->set_error(ctx,500, "Unable to set projection on mapObj.");
+      errors = msGetErrorObj();
+      char* msg = (char*) msSmallMalloc(MESSAGELENGTH+1);
+      msg = msStrdup(errors->message);
+
+      ctx->set_error(ctx,500, "Unable to set projection on mapObj. MapServer reports: %s", msg);
+      msFree(msg);
       return;
    }
    switch(map->grid_link->grid->unit) {
@@ -88,7 +100,12 @@
 
    imageObj *image = msDrawMap(omap, MS_FALSE);
    if(!image) {
-      ctx->set_error(ctx,500,"mapserver failed to create image, check logs");
+      errors = msGetErrorObj();
+      char* msg = (char*) msSmallMalloc(MESSAGELENGTH+1);
+      msg = msStrdup(errors->message);
+
+      ctx->set_error(ctx,500, "MapServer failed to create image. MapServer reports: %s", msg);
+      msFree(msg);
       msFreeMap(omap);
       return;
    }



More information about the mapserver-commits mailing list