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/cea.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/cea.cpp')
| -rw-r--r-- | src/projections/cea.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/projections/cea.cpp b/src/projections/cea.cpp index b7874b90..0d850b49 100644 --- a/src/projections/cea.cpp +++ b/src/projections/cea.cpp @@ -53,7 +53,7 @@ static PJ_LP cea_s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, inverse lp.phi = asin(xy.y); lp.lam = xy.x / P->k0; } else { - proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION); + proj_errno_set(P, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); return lp; } return (lp); @@ -75,15 +75,19 @@ PJ *PROJECTION(cea) { double t = 0.0; 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; P->destructor = destructor; if (pj_param(P->ctx, P->params, "tlat_ts").i) { - P->k0 = cos(t = pj_param(P->ctx, P->params, "rlat_ts").f); + t = pj_param(P->ctx, P->params, "rlat_ts").f; + P->k0 = cos(t); if (P->k0 < 0.) - return pj_default_destructor (P, PJD_ERR_LAT_TS_LARGER_THAN_90); + { + proj_log_error(P, _("Invalid value for lat_ts: |lat_ts| should be <= 90°")); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); + } } if (P->es != 0.0) { t = sin(t); @@ -91,7 +95,7 @@ PJ *PROJECTION(cea) { P->e = sqrt(P->es); Q->apa = pj_authset(P->es); if (!(Q->apa)) - return pj_default_destructor(P, ENOMEM); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP /*ENOMEM*/); Q->qp = pj_qsfn(1., P->e, P->one_es); P->inv = cea_e_inverse; |
