fix(cwl): Remove wrapping pre-stream exceptions and just letting them throw #5976
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
Exceptions can occur pre-stream (the synchronous portion of a StartLiveTail call that establishes the streaming connection). Currently, we are calling StartLiveTail in a try-catch, catching errrors, and throwing them as a ToolkitException. These are not chaining the root exception. This means when an error occurs, its root cause is being swallowed - causing user's to not know why their LiveTall command is failing.
Solution
Given that we are just rethrowing
err. There's probably no point to this catch. Removing it, and letting the root exception throw.Forced pre-stream exception to throw with an IAM permission violation and this change applied. More clear as to what the actual problem is:
Pop-up:
Failed to run command: aws.cwl.tailLogGroup: User: arn:aws:sts::203607498903:assumed-role/NoLiveTail/keegani-Isengard is not authorized to perform: logs:StartLiveTail on resource: arn:aws:logs:us-east-1:203607498903:log-group:/aws/codebuild/BATSSandboxCodeBuildPr-bf0a23097fbc3948a2c5b26f1616f7d32b622cba because no identity-based policy allows the logs:StartLiveTail actionFull log:
License: I confirm that my contribution is made under the terms of the Apache 2.0 license.