diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-12-15 00:51:46 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-12-15 01:13:43 +0100 |
| commit | 244a24104ded3a4573aeffa32160af21f76cbce6 (patch) | |
| tree | f3a11529172719657cf7576e062e45e0f9452db5 /src/projections/tpeqd.cpp | |
| parent | 1e9894b0e2b161e61546672bccb85a9ef21df541 (diff) | |
| download | PROJ-244a24104ded3a4573aeffa32160af21f76cbce6.tar.gz PROJ-244a24104ded3a4573aeffa32160af21f76cbce6.zip | |
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
Diffstat (limited to 'src/projections/tpeqd.cpp')
| -rw-r--r-- | src/projections/tpeqd.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/projections/tpeqd.cpp b/src/projections/tpeqd.cpp index 90efb395..d6d8e790 100644 --- a/src/projections/tpeqd.cpp +++ b/src/projections/tpeqd.cpp @@ -66,7 +66,7 @@ PJ *PROJECTION(tpeqd) { double lam_1, lam_2, phi_1, phi_2, A12; 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_INVALID_OP /*ENOMEM*/); P->opaque = Q; @@ -77,7 +77,10 @@ PJ *PROJECTION(tpeqd) { lam_2 = pj_param(P->ctx, P->params, "rlon_2").f; if (phi_1 == phi_2 && lam_1 == lam_2) - return pj_default_destructor(P, PJD_ERR_CONTROL_POINT_NO_DIST); + { + proj_log_error(P, _("Invalid value for lat_1/lon_1/lat_2/lon_2: the 2 points should be distinct.")); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); + } P->lam0 = adjlon (0.5 * (lam_1 + lam_2)); Q->dlam2 = adjlon (lam_2 - lam_1); @@ -92,7 +95,8 @@ PJ *PROJECTION(tpeqd) { Q->z02 = aacos(P->ctx, Q->sp1 * Q->sp2 + Q->cp1 * Q->cp2 * cos (Q->dlam2)); if( Q->z02 == 0.0 ) { // Actually happens when both lat_1 = lat_2 and |lat_1| = 90 - return pj_default_destructor(P, PJD_ERR_LAT_1_OR_2_ZERO_OR_90); + proj_log_error(P, _("Invalid value for lat_1 and lat_2: their absolute value should be < 90°.")); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } Q->hz0 = .5 * Q->z02; A12 = atan2(Q->cp2 * sin (Q->dlam2), |
