-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CASMPET-6723 catch UnicodeDecodeError from os/run_command #54
Conversation
Looks like your editor changed the indentions for multiple files without any other change. Guessing we'd want a standard set of editor configs so that this doesn't happen. |
libcsm/sls/api.py
Outdated
response from sls. These fields are expected in the json response. \ | ||
The resonponse was {components_response.json()}') from error | ||
response from sls. These fields are expected in the json response. \ | ||
The resonponse was {components_response.json()}') from error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Response here too.
Also what happens if the response.json() call fails in the exception handler or throws its own exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question for @leliasen-hpe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this to ValueError. JSONDecodeError inherits from ValueError so this will correctly catch the error.
Make the `decode` an optional, and just return the string as bytes unless the developer has passed an encoding. It is false to assume an encoding, and auto-resolving the encoding is unreliable.
@kburns-hpe, I intentionally unindented all of those blocks, it wasn't an editor. All those indents were leaving large whitespaces in the print statements so I got rid of the indention. |
Instead of moving the strings to the left just do like this so the format strings can be multiline:
Etc... |
Summary and Scope
UnicodeDecodeError was seen once when testing the bss-set-image function. It is unclear what caused this error. A catch statement was added so that if this is seen again, we can better debug it.
Additionally, as part of this PR the spacing is fixed in the text of raise statement. The extra whitespace is removed.
Prerequisites
Idempotency
Risks and Mitigations