Repository navigation
PDOK-19538: report GDAL errors on generate-definitions failure - #154
Merged
Merged
Conversation
Previously, generate-definitions did not use a GDAL error handler when opening the geopackage, so a corrupt or unreadable gpkg only produced a generic Python traceback (via logger.exception) instead of a clear reason. This made it impossible for callers (e.g. the kangaroo quick check) to surface why schema generation failed. generate_definitions_for_path now opens the dataset with a GdalErrorHandler, same as validate does, and raises a new generate.GeneratorError (with the captured GDAL error trace) when the dataset could not be opened. The CLI's generate-definitions command catches this error and prints a structured GDAL_ERROR result on stdout, consistent with the error format already used by the validate command. GdalErrorHandler moved from validate.py to utils.py (re-exported from validate.py for backwards compatibility) so it can be reused from generate.py without introducing a circular import. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Daimanta
approved these changes
Sep 10, 2026
botenvouwer
deleted the
PDOK-19538-generate-definitions-error-output
branch
September 10, 2026 13:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PDOK-19538
Bij een corrupt of onleesbaar gpkg-bestand gaf
generate-definitionsalleen een generieke Python-traceback (vialogger.exception), in tegenstelling totvalidate, dat GDAL-fouten netjes opvangt en gestructureerd rapporteert. Hierdoor was bij een falende quick check niet te zien waarom schemageneratie mislukte.Wijzigingen
generate_definitions_for_pathopent het gpkg-bestand nu met eenGdalErrorHandler(zelfde mechanisme alsvalidate) en gooit een nieuwegenerate.GeneratorError(met de opgevangen GDAL-fouttrace) wanneer de dataset niet geopend kan worden.generate-definitionsvangt dezeGeneratorErrorop en print een gestructureerdGDAL_ERROR-resultaat op stdout (zelfde format alsvalidategebruikt), in plaats van alleen een ruwe traceback op stderr.GdalErrorHandleris verplaatst vanvalidate.pynaarutils.py(met backwards-compatible re-export invalidate.py) zodatgenerate.pydeze kan hergebruiken zonder circulaire import.tests/test_generate.py,tests/test_cli.py) die het gedrag verifiëren met de bestaandetests/data/test_broken_geopackage.gpkg-fixture.Voorbeeld (voor de fix)
Voorbeeld (na de fix)
{ "validation_code": "GDAL_ERROR", "validation_description": "Could not open gpkg.", "level": "unknown_warning", "locations": [ "At least one of the required GeoPackage tables, gpkg_spatial_ref_sys or gpkg_contents, is missing" ] }Vervolgstap (aparte PR, in k8s-clusters): de workflow-template
generate-definitionsaanpassen zodat deze foutoutput ook bij falen als artifact wordt vastgelegd, zodat de front-end quick check de fout kan tonen.🤖 Generated with Copilot CLI