From 7abedc875260a27c45196b90ce9a7252008834ee Mon Sep 17 00:00:00 2001 From: Jesse Vickery Date: Wed, 18 Mar 2026 15:33:12 +0000 Subject: [PATCH 1/2] fix(logs): explicit logging; - Added explicit error logging in view func. --- ckanext/xloader/views.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ckanext/xloader/views.py b/ckanext/xloader/views.py index 6216ba74..338b12f6 100644 --- a/ckanext/xloader/views.py +++ b/ckanext/xloader/views.py @@ -1,4 +1,6 @@ from flask import Blueprint +# (canada fork only): catch all exceptions for explicit logging +from logging import getLogger # (canada fork only): ckan.plugins.toolkit from ckan.plugins.toolkit import _, h, g, render, request, abort, NotAuthorized, get_action, ObjectNotFound @@ -7,6 +9,8 @@ xloader = Blueprint("xloader", __name__) +# (canada fork only): catch all exceptions for explicit logging +log = getLogger(__name__) def get_blueprints(): @@ -47,6 +51,12 @@ def delete_datastore_table(id, resource_id): "force": True}) except NotAuthorized: return abort(403, _(u'Unauthorized to delete resource %s') % resource_id) + # (canada fork only): catch all exceptions for explicit logging + # datastore_delete can raise various DB exceptions + except Exception as e: + log.error('Failed to delete DataStore table ' + 'for Resource %s with errors:\n\n%s' % (resource_id, e)) + return abort(500) h.flash_notice(_(u'DataStore and Data Dictionary deleted for resource %s') % resource_id) From 17994a402ae502e670fa1b2656a34a2f7368971b Mon Sep 17 00:00:00 2001 From: Jesse Vickery Date: Wed, 18 Mar 2026 15:37:25 +0000 Subject: [PATCH 2/2] feat(misc): changelog; - Added change log file. --- changes/34.canada.changes | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/34.canada.changes diff --git a/changes/34.canada.changes b/changes/34.canada.changes new file mode 100644 index 00000000..7b00bd2a --- /dev/null +++ b/changes/34.canada.changes @@ -0,0 +1 @@ +Explicitly log Database (and other) Exceptions in the `delete_datastore_table` view function via the `datastore_delete` action. This fixes an issue with ambiguous stacktraces only logging `TypeError` for view function return instead of the parent Exception.