Skip to content

Commit

Permalink
chore: make function 'private'
Browse files Browse the repository at this point in the history
  • Loading branch information
admy7 committed Sep 13, 2024
1 parent 985fcf4 commit 00aef60
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ckanext/gdi_userportal/logic/action/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@
log = logging.getLogger(__name__)


def handle_exception(e: Exception, message: str):
log.error(f"{message}: %s", str(e))
if isinstance(e, toolkit.ObjectNotFound):
raise toolkit.ObjectNotFound("No results found for the provided query.")
raise toolkit.ValidationError(f"An error occurred: {str(e)}")


@toolkit.side_effect_free
def enhanced_package_search(context, data_dict=None) -> Dict:
data_dict = data_dict or toolkit.request.json
Expand All @@ -45,4 +38,11 @@ def enhanced_package_search(context, data_dict=None) -> Dict:

return result
except Exception as e:
handle_exception(e, "Error in enhanced_package_search")
_handle_exception(e, "Error in enhanced_package_search")


def _handle_exception(e: Exception, message: str):
log.error(f"{message}: %s", str(e))
if isinstance(e, toolkit.ObjectNotFound):
raise toolkit.ObjectNotFound("No results found for the provided query.")
raise toolkit.ValidationError(f"An error occurred: {str(e)}")

0 comments on commit 00aef60

Please sign in to comment.