Skip to content

Commit 08ba8f5

Browse files
committed
Exit add-on on fatal errors
This prevents the add-on from entering an empty virtual directory when the request could not be handled. We may want to do this for other specific HTTP errors...
1 parent f2424ae commit 08ba8f5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

resources/lib/kodiutils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
from __future__ import absolute_import, division, unicode_literals
66
from contextlib import contextmanager
7-
from sys import version_info
87
from socket import timeout
98
from ssl import SSLError
9+
from sys import exit, version_info
1010

1111
import xbmc
1212
import xbmcaddon
@@ -1097,17 +1097,17 @@ def open_url(url, data=None, headers=None, method=None, cookiejar=None, follow_r
10971097
ok_dialog(heading='HTTP Error 400: {reason}'.format(reason=exc.reason), message=localize(30967))
10981098
log_error('HTTP Error 400: Probably exceeded maximum url length: '
10991099
'VRT Search API url has a length of {length} characters.', length=url_length)
1100-
return None
1100+
exit('HTTP Error 400')
11011101
if exc.code == 413 and url_length > 8192:
11021102
ok_dialog(heading='HTTP Error 413: {reason}'.format(reason=exc.reason), message=localize(30967))
11031103
log_error('HTTP Error 413: Exceeded maximum url length: '
11041104
'VRT Search API url has a length of {length} characters.', length=url_length)
1105-
return None
1105+
exit('HTTP Error 413')
11061106
if exc.code == 431:
11071107
ok_dialog(heading='HTTP Error 431: {reason}'.format(reason=exc.reason), message=localize(30967))
11081108
log_error('HTTP Error 431: Request header fields too large: '
11091109
'VRT Search API url has a length of {length} characters.', length=url_length)
1110-
return None
1110+
exit('HTTP Error 431')
11111111
if exc.code == 401:
11121112
ok_dialog(heading='HTTP Error 401: {reason}'.format(reason=exc.reason), message='{}\n{}'.format(url, exc.reason))
11131113
log_error('HTTP Error {code}: {reason}', code=exc.code, reason=exc.reason)

0 commit comments

Comments
 (0)