Python: Make sure to log errors from async handlers (#2820)

## Motivation and Context
We were skipping logging of the errors occurred during execution of
asynchronous Python handlers due to the question mark at the end:
```
result.await.map(|r| #{pyo3}::Python::with_gil(|py| r.extract::<$output>(py)))? // <-
```

Any exception thrown in asynchronous Python handlers will be logged
properly with this change.

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
This commit is contained in:
Burak 2023-06-29 15:42:47 +01:00 committed by GitHub
parent 1de38029b7
commit ba726ef1eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -115,7 +115,7 @@ class PythonServerOperationHandlerGenerator(
};
#{pyo3_asyncio}::tokio::into_future(coroutine)
})?;
result.await.map(|r| #{pyo3}::Python::with_gil(|py| r.extract::<$output>(py)))?
result.await.and_then(|r| #{pyo3}::Python::with_gil(|py| r.extract::<$output>(py)))
""",
*codegenScope,
)