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/factors.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/factors.cpp') diff --git a/src/factors.cpp b/src/factors.cpp index ff733d07..d6c24f01 100644 --- a/src/factors.cpp +++ b/src/factors.cpp @@ -36,8 +36,15 @@ int pj_factors(PJ_LP lp, const PJ *P, double h, struct FACTORS *fac) { fac->code = 0; /* Check for latitude or longitude overange */ - if ((fabs (lp.phi)-M_HALFPI) > EPS || fabs (lp.lam) > 10.) { - proj_errno_set (P, PJD_ERR_LAT_OR_LON_EXCEED_LIMIT); + if ((fabs (lp.phi)-M_HALFPI) > EPS ) + { + proj_log_error(P, _("Invalid latitude")); + proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_INVALID_COORD); + return 1; + } + if( fabs (lp.lam) > 10.) { + proj_log_error(P, _("Invalid longitude")); + proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_INVALID_COORD); return 1; } @@ -62,7 +69,8 @@ int pj_factors(PJ_LP lp, const PJ *P, double h, struct FACTORS *fac) { /* Derivatives */ if (pj_deriv (lp, h, P, &(fac->der))) { - proj_errno_set (P, PJD_ERR_LAT_OR_LON_EXCEED_LIMIT); + proj_log_error(P, _("Invalid latitude or longitude")); + proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_INVALID_COORD); return 1; } -- cgit v1.2.3