# Buggy code
def issue_title(self):
    """Return the expected issue title for this logline."""
    result = self.traceback_lines[-1] if self.traceback_lines else self.message
    return result[:1000]


# Traceback (ApiException)
2018-06-14 15:13:41 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Checking if /volume2/video/TV-Series/America's Book of Secrets/Season 3/America's Book of Secrets S03E10 - America's Doomsday Plan (SDTV spasm).metathumb exists: True
2018-06-14 15:13:41 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Checking if /volume2/video/TV-Series/America's Book of Secrets/Season 2/America's Book of Secrets S02E11 - Lost Treasures (SDTV afg).nfo exists: True
2018-06-14 15:13:41 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Checking if /volume2/video/TV-Series/America's Book of Secrets/Season 2/America's Book of Secrets S02E11 - Lost Treasures (SDTV afg)-thumb.jpg exists: True
2018-06-14 15:13:41 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Checking if /volume2/video/TV-Series/America's Book of Secrets/Season 2/America's Book of Secrets S02E11 - Lost Treasures (SDTV afg).xml exists: True
2018-06-14 15:13:41 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Checking if /volume2/video/TV-Series/America's Book of Secrets/Season 2/America's Book of Secrets S02E11 - Lost Treasures (SDTV afg).metathumb exists: True
2018-06-14 15:13:41 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Checking if /volume2/video/TV-Series/America's Book of Secrets/Season 2/America's Book of Secrets S02E12 - Hells Angels (SDTV spasm).nfo exists: True
2018-06-14 15:13:41 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Checking if /volume2/video/TV-Series/America's Book of Secrets/Season 2/America's Book of Secrets S02E12 - Hells Angels (SDTV spasm)-thumb.jpg exists: True
2018-06-14 15:13:41 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Checking if /volume2/video/TV-Series/America's Book of Secrets/Season 2/America's Book of Secrets S02E12 - Hells Angels (SDTV spasm).xml exists: True
2018-06-14 15:13:41 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Checking if /volume2/video/TV-Series/America's Book of Secrets/Season 2/America's Book of Secrets S02E12 - Hells Angels (SDTV spasm).metathumb exists: True
2018-06-14 15:13:41 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Getting show banners for 256002
2018-06-14 15:13:41 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] GET URL: https://api.thetvdb.com/series/256002/images [Status: 200]
2018-06-14 15:13:41 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] User-Agent: Medusa/0.2.5 (Linux; 3.10.102; 1d034ca1-6f88-11e8-ad7e-024246a7e875)
2018-06-14 15:13:41 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=88331 (192.168.0.12) 4.36ms
2018-06-14 15:13:41 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=283830 (192.168.0.12) 5.12ms
2018-06-14 15:13:41 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=256002 (192.168.0.12) 9.47ms
2018-06-14 15:13:41 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=303598 (192.168.0.12) 9.95ms
2018-06-14 15:13:41 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=265688 (192.168.0.12) 4.34ms
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] GET URL: https://api.thetvdb.com/series/256002/images/query?keyType=fanart [Status: 200]
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] User-Agent: Medusa/0.2.5 (Linux; 3.10.102; 1d034ca1-6f88-11e8-ad7e-024246a7e875)
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: fanart/original/256002-1.jpg
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: 
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: fanart/original/256002-2.jpg
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: 
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] GET URL: https://api.thetvdb.com/series/256002/images/query?keyType=poster [Status: 200]
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] User-Agent: Medusa/0.2.5 (Linux; 3.10.102; 1d034ca1-6f88-11e8-ad7e-024246a7e875)
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: posters/256002-1.jpg
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: 
2018-06-14 15:13:42 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=264390 (192.168.0.12) 5.21ms
2018-06-14 15:13:42 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=256002 (192.168.0.12) 10.40ms
2018-06-14 15:13:42 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=256237 (192.168.0.12) 9.74ms
2018-06-14 15:13:42 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=279034 (192.168.0.12) 18.76ms
2018-06-14 15:13:42 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=305279 (192.168.0.12) 17.98ms
2018-06-14 15:13:42 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=265303 (192.168.0.12) 18.12ms
2018-06-14 15:13:42 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=265688 (192.168.0.12) 18.19ms
2018-06-14 15:13:42 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=281940 (192.168.0.12) 12.00ms
2018-06-14 15:13:42 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=93991 (192.168.0.12) 10.33ms
2018-06-14 15:13:42 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=253482 (192.168.0.12) 7.75ms
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] GET URL: https://api.thetvdb.com/series/256002/images/query?keyType=season [Status: 200]
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] User-Agent: Medusa/0.2.5 (Linux; 3.10.102; 1d034ca1-6f88-11e8-ad7e-024246a7e875)
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: seasons/256002-1.jpg
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: 
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: seasons/256002-2.jpg
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: 
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: seasons/256002-0.jpg
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: 
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: seasons/256002-3.jpg
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: 
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] GET URL: https://api.thetvdb.com/series/256002/images/query?keyType=series [Status: 200]
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] User-Agent: Medusa/0.2.5 (Linux; 3.10.102; 1d034ca1-6f88-11e8-ad7e-024246a7e875)
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: graphical/256002-g.jpg
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Adding base url for image: 
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] No banners found for 256002
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Found 2 fanarts at 1280x720 (1) resolution for series 256002
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Found 2 total fanarts for series 256002
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Fanart threshold set to 0.0 votes
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Weighted fanart results for series 256002:
     Score     Rating  Votes      Resolution	URL
     0.500      0.000      0        1280x720	http://thetvdb.com/banners/fanart/original/256002-1.jpg
     0.500      0.000      0        1280x720	http://thetvdb.com/banners/fanart/original/256002-2.jpg
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Multiple fanarts at highest weighted score for series 256002:
     Score     Rating  Votes      Resolution	URL
     0.500      0.000      0        1280x720	http://thetvdb.com/banners/fanart/original/256002-1.jpg
     0.500      0.000      0        1280x720	http://thetvdb.com/banners/fanart/original/256002-2.jpg
2018-06-14 15:13:42 INFO     SHOWQUEUE-REFRESH :: [c65ca26] Selected fanart for series 256002 (score=0.5, score_bay=0.0, rating=0, votes=0, res=1280x720): http://thetvdb.com/banners/fanart/original/256002-1.jpg
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Full info for best fanart for series 256002: {u'rating': 0, u'_thumbnailpath': u'http://thetvdb.com/banners/', u'score_weighted': 0.5, u'bannertype2': u'1280x720', u'bannertype': u'fanart', u'score_rated': 0.0, u'ratingcount': 0, u'res_index': 1, u'_bannerpath': u'http://thetvdb.com/banners/fanart/original/256002-1.jpg', u'resolution': u'1280x720', u'sub_key': u'graphical'}
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Found 1 posters at 680x1000 (1) resolution for series 256002
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Found 1 total posters for series 256002
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Poster threshold set to 0.0 votes
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Weighted poster results for series 256002:
     Score     Rating  Votes      Resolution	URL
     0.500      0.000      0        680x1000	http://thetvdb.com/banners/posters/256002-1.jpg
2018-06-14 15:13:42 INFO     SHOWQUEUE-REFRESH :: [c65ca26] Selected poster for series 256002 (score=0.5, score_bay=0.0, rating=0, votes=0, res=680x1000): http://thetvdb.com/banners/posters/256002-1.jpg
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Full info for best poster for series 256002: {u'rating': 0, u'_thumbnailpath': u'http://thetvdb.com/banners/', u'score_weighted': 0.5, u'bannertype2': u'680x1000', u'bannertype': u'poster', u'score_rated': 0.0, u'ratingcount': 0, u'res_index': 1, u'_bannerpath': u'http://thetvdb.com/banners/posters/256002-1.jpg', u'resolution': u'680x1000', u'sub_key': u''}
2018-06-14 15:13:42 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Getting actors for 256002
2018-06-14 15:13:43 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] GET URL: https://api.thetvdb.com/series/256002/actors [Status: 404]
2018-06-14 15:13:43 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] User-Agent: Medusa/0.2.5 (Linux; 3.10.102; 1d034ca1-6f88-11e8-ad7e-024246a7e875)
2018-06-14 15:13:43 WARNING  SHOWQUEUE-REFRESH :: [c65ca26] could not connect to TheTvdb.com, reason 'HTTPError
404 Client Error: Not Found for url: https://api.thetvdb.com/series/256002/actors'
2018-06-14 15:13:43 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] Getting actors for 256002
2018-06-14 15:13:43 INFO     TORNADO :: [c65ca26] 304 GET /home/getManualSearchStatus?indexername=tvdb&seriesid=299233 (192.168.0.12) 5.89ms
2018-06-14 15:13:45 INFO     TORNADO :: [c65ca26] 200 GET /config/general/ (192.168.0.12) 1584.64ms
2018-06-14 15:13:45 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] GET URL: https://tvdb2.plex.tv/series/256002/actors [Status: 404]
2018-06-14 15:13:45 DEBUG    SHOWQUEUE-REFRESH :: [c65ca26] User-Agent: Medusa/0.2.5 (Linux; 3.10.102; 1d034ca1-6f88-11e8-ad7e-024246a7e875)
2018-06-14 15:13:45 ERROR    SHOWQUEUE-REFRESH :: [c65ca26] 256002: Error while refreshing show America's Book of Secrets. Error: (404)
Reason: HTTPError
404 Client Error: Not Found for url: https://tvdb2.plex.tv/series/256002/actors
Traceback (most recent call last):
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/show_queue.py", line 686, in run
    self.show.refresh_dir()
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/tv/series.py", line 1713, in refresh_dir
    self.load_episodes_from_dir()
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/tv/series.py", line 986, in load_episodes_from_dir
    cur_episode = self.make_ep_from_file(os.path.join(self.location, media_file))
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/tv/series.py", line 1352, in make_ep_from_file
    root_ep.create_meta_files()
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/tv/episode.py", line 1105, in create_meta_files
    self.__create_thumbnail(metadata_provider)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/tv/episode.py", line 1128, in __create_thumbnail
    result = metadata_provider.create_episode_thumb(self) or result
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/metadata/generic.py", line 331, in create_episode_thumb
    return self.save_thumbnail(ep_obj)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/metadata/generic.py", line 501, in save_thumbnail
    thumb_data = self._retrieve_show_image(u'thumbnail', ep_obj.series, ep_obj)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/metadata/generic.py", line 738, in _retrieve_show_image
    indexer_show_obj = self._get_show_data(show_obj)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/metadata/generic.py", line 863, in _get_show_data
    my_show = self.indexer_api[int(series_id)]
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/indexers/indexer_base.py", line 399, in __getitem__
    self._get_show_data(key, self.config['language'])
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/indexers/tvdbv2/tvdbv2_api.py", line 611, in _get_show_data
    self._parse_actors(sid)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/indexers/tvdbv2/fallback.py", line 136, in __call__
    return self.func(*args, **kwargs)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/indexers/tvdbv2/tvdbv2_api.py", line 545, in _parse_actors
    actors = self.config['session'].series_api.series_id_actors_get(sid)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/lib/tvdbapiv2/apis/series_api.py", line 282, in series_id_actors_get
    callback=params.get('callback'))
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/lib/tvdbapiv2/api_client.py", line 295, in call_api
    response_type, auth_settings, callback)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/lib/tvdbapiv2/api_client.py", line 122, in __call_api
    post_params=post_params, body=body)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/lib/tvdbapiv2/api_client.py", line 315, in request
    headers=headers)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/lib/tvdbapiv2/rest.py", line 70, in get
    query_params=query_params)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/lib/tvdbapiv2/rest.py", line 63, in request
    raise ApiException(status=status, reason=msg)
ApiException: (404)
Reason: HTTPError
404 Client Error: Not Found for url: https://tvdb2.plex.tv/series/256002/actors

# Fixed code
def issue_title(self):
    """Return the expected issue title for this logline."""
    if self.traceback_lines:
        result = next(
            (line for line in reversed(self.traceback_lines) if line.strip()),
            self.message,
        )
    else:
        result = self.message
    return result[:1000]