| 577 | raise e |
| 578 | |
| 579 | def comment_failure(self, msg: str, exceptions: Exception | list[Exception]): |
| 580 | if not isinstance(exceptions, list): |
| 581 | exceptions = [exceptions] |
| 582 | |
| 583 | logging.info(f"Failed, commenting {exceptions}") |
| 584 | |
| 585 | # Extract all the traceback strings |
| 586 | for item in exceptions: |
| 587 | try: |
| 588 | raise item |
| 589 | except Exception: |
| 590 | item.exception_msg = traceback.format_exc() |
| 591 | |
| 592 | comment = f"{msg} in {args.run_url}\n\n" |
| 593 | for exception in exceptions: |
| 594 | comment += f"<details>\n\n```\n{exception.exception_msg}\n```\n\n" |
| 595 | if hasattr(exception, "read"): |
| 596 | comment += f"with response\n\n```\n{exception.read().decode()}\n```\n\n" |
| 597 | comment += "</details>" |
| 598 | |
| 599 | pr.comment(comment) |
| 600 | pr.has_error = True |
| 601 | return exception |
| 602 | |
| 603 | |
| 604 | def check_author(pr, triggering_comment, args): |