fix(notebooks): surface exception type on empty-message failures#581
Merged
nathantournant merged 1 commit intoMay 31, 2026
Merged
Conversation
5647ceb to
771fccc
Compare
When sync-cli fails on a notebook resource with a bare aiohttp.ServerTimeoutError() or asyncio.TimeoutError() (both have empty __str__), the failure log emitted by resources_handler reads exactly: ERROR - [notebooks - <id>] - The trailing dash + space + newline is literal — the error body is the empty string, not truncated. Operators are left with no signal distinguishing a timeout from a 5xx with empty body from a network reset. Introduce format_exc_for_log(exc) in utils/resource_utils.py: - timeout family (asyncio.TimeoutError, aiohttp.ServerTimeoutError) -> 'timeout: <ClassName>[: <msg>]' so 'timeout:' is greppable. - non-empty str(exc) -> verbatim (no regression for the common path; CustomClientHTTPError / SkipResource / etc. unchanged). - empty str(exc) -> falls back to the exception class name. Applied at all four failure-log sites in resources_handler.py: _apply_resource_cb (the failure site this issue surfaced from), _import_resource, _force_missing_dep_import_cb, _cleanup_worker. The import path additionally promotes the exception detail from DEBUG into the ERROR line — operator log harvests only see ERROR, so the previous DEBUG-only attachment was invisible at default verbosity. This makes the error visible; it does not change the underlying timeout. Tuning that is a follow-up once the type is visible.
771fccc to
39b6911
Compare
michael-richey
approved these changes
May 28, 2026
heyronhay
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Notebook sync failures can surface an empty error message, leaving operators with no diagnostic signal:
The trailing dash + space + newline is literal — the error body is empty, not truncated.
Root cause: bare
aiohttp.ServerTimeoutError()andasyncio.TimeoutError()have empty__str__. They propagate throughcustom_client.py(which doesn't translate them) intoresources_handler.py'sexcept Exception as eblock, where the handler logsstr(e)directly.Fix
New helper
format_exc_for_log(exc)indatadog_sync/utils/resource_utils.py:asyncio.TimeoutError,aiohttp.ServerTimeoutError) →timeout: <ClassName>[: <msg>]str(exc)→ returned verbatim (no regression forCustomClientHTTPError,SkipResource,ResourceConnectionError, etc.)str(exc)→ exception class nameApplied at four failure-log sites in
resources_handler.py:_apply_resource_cb— the exact site that emits the empty-error log line._import_resource— promotes detail from DEBUG-only to ERROR (was invisible at default verbosity)._force_missing_dep_import_cb(×2) — consistency._cleanup_worker— consistency.Tests
11 new tests in
tests/unit/test_notebooks_error_formatting.py:ResourcesHandlerintegration tests pinning the empty-error / timeout / non-empty-pass-through / HTTP-error-preserved contracts.Verification
pytest tests/unit/— 629 passed, 0 failed.ruff check+black --check— clean.Out of scope
Follow-ups
format_exc_for_loghelper to other resource models if their error paths show the same shape.