gdal icon indicating copy to clipboard operation
gdal copied to clipboard

appslib: Remove references to command-line arguments in error messages

Open dbaston opened this issue 7 months ago • 1 comments

What is the bug?

As an example, from ogr2ogr_lib.cpp:

                    CPLError(
                        CE_Failure, CPLE_AppDefined,
                        "Terminating translation prematurely after failed\n"
                        "translation of layer %s (use -skipfailures to skip "
                        "errors)",
                        poFeatureLayer->GetName());

We may be calling GDALVectorTranslate from something other than ogr2ogr, so the -skipfailures option may not exist.

I was thinking perhaps we could have a global PROGRAM_NAME variable or something that's populated by the argument parser. When emitting error messages, we could check PROGRAM_NAME and tailor the text as needed.

Steps to reproduce the issue

none

Versions and provenance

master

Additional context

No response

dbaston avatar May 13 '25 15:05 dbaston

in ogr2ogr_lib.cpp, I've added a "--invoked-from-gdal-vector-convert" hidden boolean option, but that could potentially be a "--invoked-from="

rouault avatar May 13 '25 15:05 rouault