Selaa lähdekoodia

libgis: Mention session in the missing GISRC message (#2124)

This links the missing GISRC environment variable to a GRASS session in the error message. In case the error message appears without much context, it says GRASS session rather than just session. It says active session to emphasize that a finished/ended/closed session is not good enough which is likely the context when users may encounter the message (besides the case with GRASS runtime set up, but without an open/connected mapset).

The message now says environment variable instead of just variable and leaves out the dash/hyphen for better flow of the sentence. The format of the message is issue-colon-reason.

This is highly relevant to Jupyter notebooks, but it applies to the standard _grass.script.setup.init_ function as well.
Vaclav Petras 3 vuotta sitten
vanhempi
commit
f947d5ced5
1 muutettua tiedostoa jossa 3 lisäystä ja 2 poistoa
  1. 3 2
      lib/gis/env.c

+ 3 - 2
lib/gis/env.c

@@ -3,7 +3,7 @@
 
   \brief GIS library - environment routines
   
-  (C) 2001-2014 by the GRASS Development Team
+  (C) 2001-2022 by the GRASS Development Team
   
   This program is free software under the GNU General Public License
   (>=v2).  Read the file COPYING that comes with GRASS for details.
@@ -310,7 +310,8 @@ static FILE *open_env(const char *mode, int loc)
 	    st->gisrc = getenv("GISRC");
 
 	if (!st->gisrc) {
-	    G_fatal_error(_("GISRC - variable not set"));
+            G_fatal_error(_("No active GRASS session: "
+                            "GISRC environment variable not set"));
 	    return NULL;
 	}
 	strcpy(buf, st->gisrc);