-
Notifications
You must be signed in to change notification settings - Fork 108
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
Report message encoding error in JobCreator #9862
Comments
@mapellidario hi Dario! I haven't looked any further into this error message, but in case you know - by heart - the py2/py3 way to resolve it, please let us know. |
What I gathered from having a first look at this is (and please correct me if I am wrong) the following. Prerequisites
What happens here:
Solution: Instead of checking if a variable has the attribute + from builtins import bytes # this allows to refer to a list of bytes with the type "bytes" in python2 also, as if it were python3
- if hasattr(message, "decode"):
+ if type(message) == bytes: This change would make I can open a PR with this change, but I do not know if this error can be replicated in unit test, so I would need to ask you to run some tests. P.S. : |
Dario, I think that's a good description of the problem and possible solution. Can I also suggest you to create a unit test here: and try to reproduce this problem with the current code? That will give us more confidence on the proposed solution. |
This is a very nice idea, indeed! I added a unit test in this commit, which has been added to the PR as well. I manually checked that if I reverted the change it fails: using
|
This solves the issue dmwm#9862, The rationale for this change is described in the issue comments
Impact of the bug
WMAgents
Describe the bug
I've seen an issue with JobCreator - while creating a job area - and it looks like WMException class is unable to encode all the error message raised from JobCreator, which actually masks the original exception/error in the component.
How to reproduce it
not sure
Expected behavior
Error messages should be properly encoded/decoded using utf-8 codec. If needed we can ignore and bypass when a byte/word can't be encoded/decoded, it's only for error reporting anyways.
Additional context and error message
Exception from submit8, running the latest WMAgent tag 1.3.6:
The text was updated successfully, but these errors were encountered: