Skip to content
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

Add stacktrace to exception message. #24

Merged
merged 2 commits into from
Nov 18, 2024
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
8 changes: 6 additions & 2 deletions rpe/engines/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import importlib.util
import inspect
import sys
import traceback

from dataclasses import asdict

Expand Down Expand Up @@ -114,8 +115,11 @@ def evaluate(self, resource):

# These are user-provided modules, we need to catch any exception
except Exception as e:
print(f"Evaluation exception. Policy: {policy_name}, Message: {str(e)}")

print(
"Evaluation exception. Policy: {0}, Message: {1}, Exception Stacktrace: {2}".format(
policy_name, repr(e), traceback.format_exc()
)
)
return evals

def _legacy_eval(self, resource, policy_name, policy_cls):
Expand Down
Loading