[PROJ] Catching error from proj_create_operations

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PROJ] Catching error from proj_create_operations

Nyall Dawson
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
[hidden email]
https://lists.osgeo.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: Catching error from proj_create_operations

Alan Snow
In pyproj, we use a custom log function to catch the error log messages:

And pass the custom function into `proj_log_func`: 

Hope this helps,
Alan


On Thu, May 30, 2019, 10:13 PM Nyall Dawson <[hidden email]> 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
[hidden email]
https://lists.osgeo.org/mailman/listinfo/proj

_______________________________________________
PROJ mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/proj