donnemartin / gitsome

A supercharged Git/GitHub command line interface (CLI). An official integration for GitHub and GitHub Enterprise: https://github.com/works-with/category/desktop-tools
Other
7.56k stars 437 forks source link

Check for None in CreateEvent description #89

Closed SanketDG closed 7 years ago

codecov-io commented 7 years ago

Current coverage is 95.18% (diff: 100%)

Merging #89 into master will not change coverage

@@             master        #89   diff @@
==========================================
  Files            34         34          
  Lines          2076       2076          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           1976       1976          
  Misses          100        100          
  Partials          0          0          

Powered by Codecov. Last update eebb2cf...9a0d16f

donnemartin commented 7 years ago

Hi @SanketDG, thanks for the PR! I'll try to review it this week.

donnemartin commented 7 years ago

Looks good! I think the results from the API might have changed which might have caused this issue.

Note how the description key lookup is wrapped in a try/except block catching a KeyError. I suspect the description key might not have been sent in the past if the event description is missing, but we see it is now sent with a value of None.

        try:
            item += self._format_indented_message(
                ('' if event.payload['description'] is None
                 else event.payload['description']))
        except KeyError:
            pass

I'd leave the code catching KeyError in place as a further safeguard.