[PROJ] Catching error from proj_create_operations

Alan Snow alansnow21 at gmail.com
Thu May 30 20:55:46 PDT 2019


In pyproj, we use a custom log function to catch the error log messages:
https://github.com/pyproj4/pyproj/blob/0221652c4cce274d72b0a82305d82c13e4b0535b/pyproj/_datadir.pyx#L9

And pass the custom function into `proj_log_func`:
https://github.com/pyproj4/pyproj/blob/0221652c4cce274d72b0a82305d82c13e4b0535b/pyproj/_datadir.pyx#L35

Hope this helps,
Alan


On Thu, May 30, 2019, 10:13 PM Nyall Dawson <nyall.dawson at gmail.com> wrote:

> Hi list,
>
> What's the correct way to get errors as a result of a
> proj_create_operations call? When trying to create a (deliberately)
> bad operation, I can see on the console that proj throws a nice
> descriptive warning:
>
> "internal_proj_create_operations: Source and target ellipsoid do not
> belong to the same celestial body"
>
> And, as expected, the function returns a nullptr. I'm trying to
> retrieve this descriptive error string for display to users, but can't
> work out how to do this. I can't use proj_errno, since I don't have a
> object to retrieve from. And if I try to retrieve from the context
> using proj_context_errno, I just get a -61 "generic error of unknown
> origin" message.
>
> Any suggestions?
>
> Nyall
> _______________________________________________
> PROJ mailing list
> PROJ at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/proj
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20190530/11dc8427/attachment.html>


More information about the PROJ mailing list