Uh oh!
There was an error while loading. Please reload this page.
Fix TypeError: 'NoneType' object is not iterable during deserialization - #193
Fix TypeError: 'NoneType' object is not iterable during deserialization#193Jiashuo Li (jiasli) wants to merge 1 commit into
Conversation
Jiashuo Li (@jiasli) I'm still not sure, but right now my inclination is more to add a new extractor: defrest_key_extractor_fail_safe(*args, **kwargs):
try:
returnrest_key_extractor(*args, **kwargs):
exceptException:
returnNoneand then plug this one in the case of the serializer. Making the whole extractor robust, will impact error on regular deserialization from server (this is used in both context). |
| working_data = data | ||
| while '.' in key: | ||
| while '.' in key and working_data: |
There was a problem hiding this comment.
That's not enough, when it's None you will end the loop and still fail line 1098
There was a problem hiding this comment.
Nice catch. I only looked at the code at L1113~L1114, but didn't notice L1098. I thought they were the same. :P
Laurent Mazuel (lmazuel)
commented
Apr 7, 2020
Jiashuo Li (@jiasli) see my comment, I can't merge it as is, and Rodge Fu (@RodgeFu) also found #197 as related issue, so I'm fixing it in #198 |
Jiashuo Li (jiasli)
commented
Apr 7, 2020
Thanks for looking at this issue Laurent Mazuel (@lmazuel). I am fine with it as long as the issue is properly addressed. Meanwhile, I switched my code to use the |
msrest can't handle attribute map >= 3 layers during deserialization.
For example, for LongTermEnvironmentCreateOrUpdateParameters
properties.warmStoreConfiguration.dataRetentionhas 3 layers. The regex matching this pattern isThe CLI code I use to construct the body is
Got error:
This is because it first tries to extract
propertiesfrom the body and getsNone, but it doesn’t stop there becausewarmStoreConfiguration.dataRetentionstill has.and it continues to extractwarmStoreConfigurationfromNonewhich results in an error.This PR makes the loop continue only if
working_dataevaluates toTrue.