Skip to content

Commit 7eedfb9

Browse files
committed
style: run black
1 parent bd74225 commit 7eedfb9

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

src/functions_framework/aio/__init__.py

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -178,42 +178,46 @@ def _configure_app_execution_id_logging():
178178
)
179179

180180

181-
182-
183181
class ExceptionHandlerMiddleware:
184182
def __init__(self, app):
185183
self.app = app
186-
184+
187185
async def __call__(self, scope, receive, send):
188186
if scope["type"] != "http": # pragma: no cover
189187
await self.app(scope, receive, send)
190188
return
191-
189+
192190
try:
193191
await self.app(scope, receive, send)
194192
except Exception as exc:
195193
logger = logging.getLogger()
196194
tb_lines = traceback.format_exception(type(exc), exc, exc.__traceback__)
197195
tb_text = "".join(tb_lines)
198-
196+
199197
path = scope.get("path", "/")
200198
method = scope.get("method", "GET")
201199
error_msg = f"Exception on {path} [{method}]\n{tb_text}".rstrip()
202-
200+
203201
logger.error(error_msg)
204-
205-
headers = [[b"content-type", b"text/plain"],
206-
[_FUNCTION_STATUS_HEADER_FIELD.encode(), _CRASH.encode()]]
207-
208-
await send({
209-
"type": "http.response.start",
210-
"status": 500,
211-
"headers": headers,
212-
})
213-
await send({
214-
"type": "http.response.body",
215-
"body": b"Internal Server Error",
216-
})
202+
203+
headers = [
204+
[b"content-type", b"text/plain"],
205+
[_FUNCTION_STATUS_HEADER_FIELD.encode(), _CRASH.encode()],
206+
]
207+
208+
await send(
209+
{
210+
"type": "http.response.start",
211+
"status": 500,
212+
"headers": headers,
213+
}
214+
)
215+
await send(
216+
{
217+
"type": "http.response.body",
218+
"body": b"Internal Server Error",
219+
}
220+
)
217221
# Don't re-raise to prevent starlette from printing tracebak again
218222

219223

@@ -292,7 +296,7 @@ def create_asgi_app(target=None, source=None, signature_type=None):
292296
)
293297

294298
from starlette.middleware import Middleware
295-
299+
296300
app = Starlette(
297301
debug=False,
298302
routes=routes,

0 commit comments

Comments
 (0)