From 244a24104ded3a4573aeffa32160af21f76cbce6 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 15 Dec 2020 00:51:46 +0100 Subject: Revise error codes to have a reduced set exposed in the public API. Fixes #2482 And also add proj_context_errno_string() Revise gie 'expect failure errno XXXX' strings --- src/conversions/topocentric.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/conversions/topocentric.cpp') diff --git a/src/conversions/topocentric.cpp b/src/conversions/topocentric.cpp index f6f328ad..4f563d9f 100644 --- a/src/conversions/topocentric.cpp +++ b/src/conversions/topocentric.cpp @@ -78,7 +78,7 @@ PJ *CONVERSION(topocentric,1) { /*********************************************************************/ struct pj_opaque *Q = static_cast(calloc (1, sizeof (struct pj_opaque))); if (nullptr==Q) - return pj_default_destructor (P, ENOMEM); + return pj_default_destructor (P, PROJ_ERR_INVALID_OP /*ENOMEM*/); P->opaque = static_cast(Q); // The topocentric origin can be specified either in geocentric coordinates @@ -97,26 +97,30 @@ PJ *CONVERSION(topocentric,1) { const auto hash0 = pj_param_exists(P->params, "h_0"); if( !hasX0 && !hasLon0 ) { - return pj_default_destructor(P, PJD_ERR_MISSING_ARGS); + proj_log_error(P, _("topocentric: missing X_0 or lon_0")); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_MISSING_ARG); } if ( (hasX0 || hasY0 || hasZ0) && (hasLon0 || hasLat0 || hash0) ) { - return pj_default_destructor(P, PJD_ERR_MUTUALLY_EXCLUSIVE_ARGS); + proj_log_error(P, _("topocentric: (X_0,Y_0,Z_0) and (lon_0,lat_0,h_0) are mutually exclusive")); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_MUTUALLY_EXCLUSIVE_ARGS); } if( hasX0 && (!hasY0 || !hasZ0) ) { - return pj_default_destructor(P, PJD_ERR_MISSING_ARGS); + proj_log_error(P, _("topocentric: missing Y_0 and/or Z_0")); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_MISSING_ARG); } if( hasLon0 && !hasLat0 ) // allow missing h_0 { - return pj_default_destructor(P, PJD_ERR_MISSING_ARGS); + proj_log_error(P, _("topocentric: missing lat_0")); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_MISSING_ARG); } // Pass a dummy ellipsoid definition that will be overridden just afterwards PJ* cart = proj_create(P->ctx, "+proj=cart +a=1"); if (cart == nullptr) - return pj_default_destructor(P, ENOMEM); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP /*ENOMEM*/); /* inherit ellipsoid definition from P to cart */ pj_inherit_ellipsoid_def (P, cart); -- cgit v1.2.3