[PROJ] About PROJ.6: inconsistent error reporting

Kristian Evers kreve at sdfe.dk
Tue Apr 2 01:42:18 PDT 2019


This is definitely something that needs to be dealt with. Good catch!

As far as I can tell the problem is that errors that occur in the new
C++ code are handled as exceptions without setting the internal
PROJ errno. Eventually the exceptions are dealt with by logging
an error message to stderr. There are two solutions:

1. Have proj_create() issue a generic errno when catching an 
exception, or

2. Set an appropriate PROJ errno when raising an exception
in the ISO19111 C++ code.

The first is the simplest but may not be suitable for all situations.
The seconds is probably the best way to handle this but the fix will
Involve a lot more work.

Even, do you have an opinion on which of the above roads to follow.
Or perhaps a better solution?

/Kristian

-----Oprindelig meddelelse-----
Fra: PROJ <proj-bounces at lists.osgeo.org> På vegne af a.furieri at lqt.it
Sendt: 2. april 2019 10:24
Til: proj at lists.osgeo.org
Emne: [PROJ] About PROJ.6: inconsistent error reporting

the third (and last) glitch I noticed in PROJ.6 is
about some inconsistent error reporting.

first example:
sometimes both proj_as_proj_string() and/or proj_as_wkt()
can fail then returning a NULL pointer (and this is
absolutely ok).

the puzzling behavior is that an error message like

"Unsupported conversion method: XXX"

will be printed on the standard error, but "errno" will
still remain set to its previous value.
the opposite will be obviously more useful, i.e. setting
"errno" to some appropriate value avoiding to print an
error message on stderr.

-----

second example:
more or less the same is for proj_create(), as shown
in the following example:

PJ *x = proj_create(0, "This is a bogus CRS");

this call will obviously fail returning NULL; what's
unexpected is that an error message:

"proj_create: unrecognized format/unknown name"

will be printed on stderr, but errno will remain set
to its previous value.

and to add even more confusion, attempting to execute
the following call:

PJ *x = proj_create(0, "+proj=utm +zone=32 +ellps=WGS_bogus");

will print on stderr the following message:

"error -9: unknown elliptical parameter name"

but will also (correctly) set "errno" to -9

it looks like if proj_create() can report errors
from a partially broken string, but fails to
report any error in the case of a completely
malformed string.

bye Sandro
_______________________________________________
PROJ mailing list
PROJ at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/proj


More information about the PROJ mailing list