Skip to content

fix(timestream): include the batch load task ErrorMessage in TimestreamLoadError - #3574

Open
abhishekacharya200 wants to merge 2 commits into
aws:mainfrom
abhishekacharya200:fix/timestream-batch-load-error-message
Open

abhishekacharya200 wants to merge 2 commits into
aws:mainfrom
abhishekacharya200:fix/timestream-batch-load-error-message

Conversation

@abhishekacharya200

Copy link
Copy Markdown
Contributor

Feature or Bugfix

  • Bugfix

Detail

  • wait_batch_load_task raised TimestreamLoadError(response.get("ErrorMessage")), but ErrorMessage is a member of BatchLoadTaskDescription in the DescribeBatchLoadTask response, not of the top-level response. The lookup always returned None, so a failed (or progress-stopped / pending-resume) batch load task raised TimestreamLoadError(None) and the service's failure reason was lost.
  • Read the message from response["BatchLoadTaskDescription"] instead (the key is optional in the model, so .get is kept).
  • Added a mocked unit test in tests/unit/test_timestream_mocked.py that fails before and passes after. No AWS account needed.

Relates

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…ait_batch_load_task

Signed-off-by: abhishekacharya200 <abhishekacharya200@users.noreply.github.com>

@Karishmashaik9 Karishmashaik9 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also add a test for a failed batch load response where ErrorMessage is missing? Since this is an optional response field, it would be good to verify that the function still raises TimestreamLoadError without introducing an unexpected exception.

@abhishekacharya200

Copy link
Copy Markdown
Contributor Author

Good point, thanks @Karishmashaik9. Added test_wait_batch_load_task_failed_without_error_message_still_raises in 7189760: a FAILED description with no ErrorMessage still raises TimestreamLoadError, since .get() returns None instead of raising KeyError. Both timestream mocked tests pass locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants