-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
🔧 chore(msteams): mark resolve in upcoming release errors as halt #92689
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -490,17 +490,24 @@ def _issue_state_change(self, group: Group, identity: RpcIdentity, data) -> Resp | |
| with MessagingInteractionEvent( | ||
| interaction_type, MsTeamsMessagingSpec() | ||
| ).capture() as lifecycle: | ||
| response = client.put( | ||
| path=f"/projects/{group.project.organization.slug}/{group.project.slug}/issues/", | ||
| params={"id": group.id}, | ||
| data=action_data, | ||
| user=user_service.get_user(user_id=identity.user_id), | ||
| auth=event_write_key, | ||
| ) | ||
| if response.status_code == 403: | ||
| lifecycle.record_halt(response) | ||
| elif response.status_code >= 400: | ||
| lifecycle.record_failure(response) | ||
| try: | ||
| response = client.put( | ||
| path=f"/projects/{group.project.organization.slug}/{group.project.slug}/issues/", | ||
| params={"id": group.id}, | ||
| data=action_data, | ||
| user=user_service.get_user(user_id=identity.user_id), | ||
| auth=event_write_key, | ||
| ) | ||
| except client.ApiError as e: | ||
| if e.status_code == 403: | ||
| lifecycle.record_halt(e) | ||
| # If the user hasn't configured their releases properly, we recieve errors like: | ||
| # sentry.api.client.ApiError: status=400 body={'statusDetails': {'inNextRelease': [xxx])]}}" | ||
| # We can mark these as halt | ||
| elif e.status_code == 400 and e.body.get("statusDetails", {}).get("inNextRelease"): | ||
| lifecycle.record_halt(e) | ||
| elif e.status_code >= 400: | ||
| lifecycle.record_failure(e) | ||
|
Comment on lines
+509
to
+510
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: thoughts on letting the error through and triggering the lifecycle/recording failure on its own ? (Curious on your thoughts since I've seen both ways)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think its stylistic atp |
||
| return response | ||
|
|
||
| def _handle_action_submitted(self, request: Request) -> Response: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious Q is there a difference between
client.ApiErrorvsApiError?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a different
ApiError, the one we usually use is from shared_exceptions, so we need to annotate client here