Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure that transient errors are returned correctly #857

Merged
merged 3 commits into from Mar 12, 2018

Conversation

@kbevers
Copy link
Member

@kbevers kbevers commented Mar 11, 2018

The prepare/finalize steps in pj_fwd*/pj_inv* now checks the error level
of the PJ object before returning the coordinate. If an error is
detected proj_coord_error() is returned.

Prompted by pytroll/mpop#49 (comment)

kbevers added 2 commits Mar 11, 2018
The prepare/finalize steps in pj_fwd*/pj_inv* now checks the error level
of the PJ object before returning the coordinate. If an error is
detected proj_coord_error() is returned.
@kbevers kbevers force-pushed the kbevers:return-error-instead-of-zeros branch from 514a91b to a077a1c Mar 12, 2018
@kbevers kbevers requested a review from busstoptaktik Mar 12, 2018
static PJ_COORD error_or_coord(PJ *P, PJ_COORD coord, int last_errno) {
if (proj_errno(P))
coord = proj_coord_error();
else

This comment has been minimized.

@busstoptaktik

busstoptaktik Mar 12, 2018
Member

Could handle the non-common case by if (...) return proj_coord_error() here.

This would raise the common case to top level, rather than partially depressed behind an else clause


XY pj_fwd(LP lp, PJ *P) {
int last_errno;
PJ_COORD coo = {{0,0,0,0}};
coo.lp = lp;

This comment has been minimized.

@busstoptaktik

busstoptaktik Mar 12, 2018
Member

It is tempting, at this stage, to consider whether we want to play ball at all if there's an unhandled exception - i.e. just do

if (proj_errno(P))
    return proj_coord_error();

It will, however, require some additional error handling in the pj_transform(), and the proj_trans...()family, to avoid an error for a single point (e.g. out of area) to result in all subsequent points in that call failing.

(this comment also applies to pj_fwd3d, pj_fwd4d, and their invcounterparts).

This comment has been minimized.

@kbevers

kbevers Mar 12, 2018
Author Member

That's a problem for another day :-)

This comment has been minimized.

@kbevers kbevers force-pushed the kbevers:return-error-instead-of-zeros branch from a077a1c to 22203cc Mar 12, 2018
@kbevers kbevers added this to the 5.0.1 milestone Mar 12, 2018
@kbevers kbevers merged commit d422d45 into OSGeo:master Mar 12, 2018
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.07%) to 75.739%
Details
kbevers added a commit that referenced this pull request Mar 12, 2018
Make sure that transient errors are returned correctly
@kbevers
Copy link
Member Author

@kbevers kbevers commented Mar 12, 2018

Cherry-picked into 5.0 branch

@kbevers kbevers deleted the kbevers:return-error-instead-of-zeros branch Mar 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.