mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-07 12:42:10 -04:00
Always close _all_ ijson
coroutines, even if doing so raises Exceptions (#14065)
This commit is contained in:
parent
44741aa85b
commit
cb20b885cb
4 changed files with 76 additions and 5 deletions
|
@ -15,7 +15,7 @@
|
|||
import json
|
||||
import logging
|
||||
import typing
|
||||
from typing import Any, Callable, Dict, Generator, Optional
|
||||
from typing import Any, Callable, Dict, Generator, Optional, Sequence
|
||||
|
||||
import attr
|
||||
from frozendict import frozendict
|
||||
|
@ -193,3 +193,15 @@ def log_failure(
|
|||
# Version string with git info. Computed here once so that we don't invoke git multiple
|
||||
# times.
|
||||
SYNAPSE_VERSION = get_distribution_version_string("matrix-synapse", __file__)
|
||||
|
||||
|
||||
class ExceptionBundle(Exception):
|
||||
# A poor stand-in for something like Python 3.11's ExceptionGroup.
|
||||
# (A backport called `exceptiongroup` exists but seems overkill: we just want a
|
||||
# container type here.)
|
||||
def __init__(self, message: str, exceptions: Sequence[Exception]):
|
||||
parts = [message]
|
||||
for e in exceptions:
|
||||
parts.append(str(e))
|
||||
super().__init__("\n - ".join(parts))
|
||||
self.exceptions = exceptions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue