diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-12-16 15:12:51 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-16 15:12:51 +0100 |
| commit | 5e077729274f5d28e137e1a41f7d3350146614ef (patch) | |
| tree | d1ef799526f06828328b58ce8ee92c028f723b6a /src/conversions/topocentric.cpp | |
| parent | 8b1ef9504d0bcfbd8433df943e307bbd1aa30c4f (diff) | |
| parent | a27c0255e7b8e6aab1b91e49fd7870d1ee4e1a80 (diff) | |
| download | PROJ-5e077729274f5d28e137e1a41f7d3350146614ef.tar.gz PROJ-5e077729274f5d28e137e1a41f7d3350146614ef.zip | |
Merge pull request #2487 from rouault/error_mgt_improvements
Error management: revise error codes and expose them to the public API
Diffstat (limited to 'src/conversions/topocentric.cpp')
| -rw-r--r-- | src/conversions/topocentric.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/conversions/topocentric.cpp b/src/conversions/topocentric.cpp index f6f328ad..bbe52400 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<struct pj_opaque*>(calloc (1, sizeof (struct pj_opaque))); if (nullptr==Q) - return pj_default_destructor (P, ENOMEM); + return pj_default_destructor (P, PROJ_ERR_OTHER /*ENOMEM*/); P->opaque = static_cast<void *>(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, _("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, _("(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, _("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, _("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_OTHER /*ENOMEM*/); /* inherit ellipsoid definition from P to cart */ pj_inherit_ellipsoid_def (P, cart); |
