[PROJ] About PROJ.6: inconsistent error reporting

a.furieri at lqt.it a.furieri at lqt.it
Tue Apr 2 01:23:34 PDT 2019


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


More information about the PROJ mailing list