Skip to content

Commit

Permalink
add more details to holmes errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aantn committed Jan 23, 2025
1 parent 5e39184 commit 3d0a86c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/robusta/core/playbooks/internal/ai_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,18 @@ def ask_holmes(event: ExecutionBaseEvent, params: AIInvestigateParams):
event.add_finding(finding)

except Exception as e:
# TODO: add cluster name to the error message
logging.exception(
f"Failed to get holmes analysis for {investigation__title} {params.context} {subject}", exc_info=True
)
if isinstance(e, requests.ConnectionError):
raise ActionException(ErrorCodes.HOLMES_CONNECTION_ERROR, "Holmes endpoint is currently unreachable.")
raise ActionException(ErrorCodes.HOLMES_CONNECTION_ERROR, f"Holmes endpoint currently unreachable: {e}")
elif isinstance(e, requests.HTTPError):
if e.response.status_code == 401 and "invalid_api_key" in e.response.text:
raise ActionException(ErrorCodes.HOLMES_REQUEST_ERROR, "Holmes invalid api key.")

raise ActionException(ErrorCodes.HOLMES_REQUEST_ERROR, "Holmes internal configuration error.")
raise ActionException(ErrorCodes.HOLMES_REQUEST_ERROR, f"Error analyzing with Holmes: {e.response.text}")
else:
raise ActionException(ErrorCodes.HOLMES_UNEXPECTED_ERROR, "An unexpected error occured.")
raise ActionException(ErrorCodes.HOLMES_UNEXPECTED_ERROR, f"Unexpected error: {e}")


@action
Expand Down

0 comments on commit 3d0a86c

Please sign in to comment.