-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Consider the stack dump from S3 "NoSuchKey", shown below. That can potentially happen on any visit to boost library docs from bots.
Would it be possible to wrap every call to S3 in a "try" block, and "catch" the error NoSuchKey, and print (for example):
"/archives/boost_1_89_0/libs/math/doc/sf_and_dist/html/math_toolkit/utils/next_float/float_distance.html/" NoSuchKey, the specified key does not exist. INFO message.
And then, not dump a stack trace, beyond the info message.
Specifically for S3 NoSuchKey type errors in the docs. (nothing else).
Would that make sense? any downside?
It would reduce errors and clean up the log output for these non-critical issues.
"""
{"name": "core.boostrenderer", "levelname": "ERROR", "filename": "boostrenderer.py", "lineno": 153, "message": "get_content_from_s3_error", "exc_info": "Traceback (most recent call last):\n File "/code/core/boostrenderer.py", line 149, in get_file_data\n response = client.get_object(Bucket=bucket_name, Key=s3_key.lstrip("/"))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/venv/lib/python3.11/site-packages/botocore/client.py", line 602, in _api_call\n return self._make_api_call(operation_name, kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/venv/lib/python3.11/site-packages/botocore/context.py", line 123, in wrapper\n return func(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^\n File "/venv/lib/python3.11/site-packages/botocore/client.py", line 1078, in _make_api_call\n raise error_class(parsed_response, operation_name)\nbotocore.errorfactory.NoSuchKey: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist.", "s3_key": "/archives/boost_1_89_0/libs/math/doc/sf_and_dist/html/math_toolkit/utils/next_float/float_distance.html/", "error": "An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist.", "function_name": "get_content_from_s3", "logger": "core.boostrenderer", "level": "error", "timestamp": "2025-10-07T20:31:58.789788Z", "exception": "Traceback (most recent call last):\n File "/code/core/boostrenderer.py", line 149, in get_file_data\n response = client.get_object(Bucket=bucket_name, Key=s3_key.lstrip("/"))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/venv/lib/python3.11/site-packages/botocore/client.py", line 602, in _api_call\n return self._make_api_call(operation_name, kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/venv/lib/python3.11/site-packages/botocore/context.py", line 123, in wrapper\n return func(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^\n File "/venv/lib/python3.11/site-packages/botocore/client.py", line 1078, in _make_api_call\n raise error_class(parsed_response, operation_name)\nbotocore.errorfactory.NoSuchKey: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist."}
"""
Metadata
Metadata
Assignees
Labels
Type
Projects
Status