diff options
| author | Brendan Jurd <brendan.jurd@geoplex.com.au> | 2022-02-04 12:56:25 +1100 |
|---|---|---|
| committer | Brendan Jurd <brendan.jurd@geoplex.com.au> | 2022-02-04 13:46:25 +1100 |
| commit | c868ea010de15b98ee1e67a81e0a29cc4a1ab734 (patch) | |
| tree | 221cb0dab519c3a863b1281fe44053d6e980dd84 /src/iso19111 | |
| parent | fc46c5bac52a20d56ea09566accfcb91198116a0 (diff) | |
| download | PROJ-c868ea010de15b98ee1e67a81e0a29cc4a1ab734.tar.gz PROJ-c868ea010de15b98ee1e67a81e0a29cc4a1ab734.zip | |
Set more precise error code for parsing errors in proj_create().
If proj_create() catches a ParsingException, and the error code hasn't
otherwise been set internally, set the error code to
PROJ_ERR_INVALID_OP_WRONG_SYNTAX instead of allowing it to default to
the generic PROJ_ERR_OTHER.
Ref #2529
Diffstat (limited to 'src/iso19111')
| -rw-r--r-- | src/iso19111/c_api.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index 527ccd4f..4823213b 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -572,6 +572,11 @@ PJ *proj_create(PJ_CONTEXT *ctx, const char *text) { if (identifiedObject) { return pj_obj_create(ctx, NN_NO_CHECK(identifiedObject)); } + } catch (const io::ParsingException &e) { + if (proj_context_errno(ctx) == 0) { + proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); + } + proj_log_error(ctx, __FUNCTION__, e.what()); } catch (const std::exception &e) { proj_log_error(ctx, __FUNCTION__, e.what()); } |
