Skip to content

Feat: Improve error logging #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions csfunctions/handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import logging
import os
import sys
import traceback
Expand All @@ -16,6 +17,8 @@
from csfunctions.response import ResponseUnion
from csfunctions.service import Service

logger = logging.getLogger(__name__)


class FunctionNotRegistered(ValueError):
"""
Expand Down Expand Up @@ -117,6 +120,7 @@ def execute(function_name: str, request_body: str, function_dir: str = "src") ->
response.event_id = request.event.event_id

except Exception as e: # pylint: disable=broad-except
logger.error("An error occurred while executing function %s", function_name, exc_info=True)
response = ErrorResponse(message=str(e), error_type=type(e).__name__, trace=traceback.format_exc(), id="")

return response.model_dump_json()
Loading