jscheffl commented on code in PR #62656:
URL: https://github.com/apache/airflow/pull/62656#discussion_r2935810938
##########
shared/logging/src/airflow_shared/logging/structlog.py:
##########
@@ -224,6 +224,20 @@ def respect_stdlib_disable(logger: Any, method_name: Any,
event_dict: EventDict)
return event_dict
+def _make_safe_enc_hook(default):
+ """Wrap an enc_hook so that serialization failures fall back to
``str()``."""
+
+ def safe_enc_hook(obj):
+ if default is not None:
+ try:
+ return default(obj)
+ except TypeError:
Review Comment:
In DockerOperator (fixed in https://github.com/apache/airflow/pull/62632) we
saw:
```
UnicodeEncodeError: 'utf-8' codec can't encode character '\udce2' in
position 76: surrogates not allowed
```
...which sub-classes from `ValueError`. So Unicode problems are not catched
by this. Can you generalize this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]