[postgis-commits] svn - r3124 - trunk/lwgeom
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Thu Oct 16 01:33:26 PDT 2008
Author: mcayland
Date: 2008-10-16 01:33:25 -0700 (Thu, 16 Oct 2008)
New Revision: 3124
Modified:
trunk/lwgeom/lwgeom_pg.c
Log:
Update to previous parser patch: if the error location is 0 (i.e. we haven't even matched a valid OGC WKT type) then display a more appropriate message. Per minor gripe from Paul.
Modified: trunk/lwgeom/lwgeom_pg.c
===================================================================
--- trunk/lwgeom/lwgeom_pg.c 2008-10-16 07:22:08 UTC (rev 3123)
+++ trunk/lwgeom/lwgeom_pg.c 2008-10-16 08:33:25 UTC (rev 3124)
@@ -48,11 +48,23 @@
/* Append to the existing string */
strncat(hintbuffer, hintstart, hintfinish-hintstart);
-
- ereport(ERROR,
- (errmsg("%s", lwg_parser_result->message),
- errhint("\"%s\" <-- parse error at position %d within geometry", hintbuffer, lwg_parser_result->errlocation))
- );
+
+ /* Only display the parser position if the location is > 0; this provides a nicer output when the first token
+ within the input stream cannot be matched */
+ if (lwg_parser_result->errlocation > 0)
+ {
+ ereport(ERROR,
+ (errmsg("%s", lwg_parser_result->message),
+ errhint("\"%s\" <-- parse error at position %d within geometry", hintbuffer, lwg_parser_result->errlocation))
+ );
+ }
+ else
+ {
+ ereport(ERROR,
+ (errmsg("%s", lwg_parser_result->message),
+ errhint("You must specify a valid OGC WKT geometry type such as POINT, LINESTRING or POLYGON"))
+ );
+ }
}
void
More information about the postgis-commits
mailing list