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/fwd.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/fwd.cpp')
| -rw-r--r-- | src/fwd.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/fwd.cpp b/src/fwd.cpp index 962a5051..97ba5999 100644 --- a/src/fwd.cpp +++ b/src/fwd.cpp @@ -52,10 +52,19 @@ static PJ_COORD fwd_prepare (PJ *P, PJ_COORD coo) { /* check for latitude or longitude over-range */ t = (coo.lp.phi < 0 ? -coo.lp.phi : coo.lp.phi) - M_HALFPI; - if (t > PJ_EPS_LAT || coo.lp.lam > 10 || coo.lp.lam < -10) { - proj_errno_set (P, PJD_ERR_LAT_OR_LON_EXCEED_LIMIT); + if (t > PJ_EPS_LAT) + { + proj_log_error(P, _("Invalid latitude")); + proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_INVALID_COORD); return proj_coord_error (); } + if (coo.lp.lam > 10 || coo.lp.lam < -10) + { + proj_log_error(P, _("Invalid longitude")); + proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_INVALID_COORD); + return proj_coord_error (); + } + /* Clamp latitude to -90..90 degree range */ if (coo.lp.phi > M_HALFPI) @@ -186,7 +195,7 @@ PJ_XY pj_fwd(PJ_LP lp, PJ *P) { else if (P->fwd4d) coo = P->fwd4d (coo, P); else { - proj_errno_set (P, EINVAL); + proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP); return proj_coord_error ().xy; } if (HUGE_VAL==coo.v[0]) @@ -220,7 +229,7 @@ PJ_XYZ pj_fwd3d(PJ_LPZ lpz, PJ *P) { else if (P->fwd) coo.xy = P->fwd (coo.lp, P); else { - proj_errno_set (P, EINVAL); + proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP); return proj_coord_error ().xyz; } if (HUGE_VAL==coo.v[0]) @@ -250,7 +259,7 @@ PJ_COORD pj_fwd4d (PJ_COORD coo, PJ *P) { else if (P->fwd) coo.xy = P->fwd (coo.lp, P); else { - proj_errno_set (P, EINVAL); + proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP); return proj_coord_error (); } if (HUGE_VAL==coo.v[0]) |
