Skip to content

Commit 37b0d30

Browse files
authored
Merge branch 'main' into 311_drop_python39
2 parents 0e8a626 + 154cae9 commit 37b0d30

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dynamic = ["version"]
88
description = "Official Python command line client for tldr pages."
99
readme = "README.md"
1010
license = "MIT"
11-
requires-python = "~=3.10"
11+
requires-python = ">=3.10"
1212
authors = [
1313
{ name = "Felix Yan and tldr-pages contributors" },
1414
]

tldr.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ def get_page_for_every_platform(
281281
return result
282282
# Know here that we don't have the info in cache
283283
result = list()
284+
error = None
284285
for platform in platforms:
285286
for language in languages:
286287
if platform is None:
@@ -300,13 +301,22 @@ def get_page_for_every_platform(
300301
break
301302
except HTTPError as err:
302303
if err.code != 404:
303-
raise
304-
except URLError:
304+
# Store error for later, only raise if we find no results at all
305+
error = err
306+
except URLError as err:
305307
if not PAGES_SOURCE_LOCATION.startswith('file://'):
306-
raise
308+
# Store error for later, only raise if we find no results at all
309+
error = err
310+
307311
if result: # Return if smth was found
308312
return result
309313

314+
# Reraise the error if we couldn't get the pages for any platform
315+
if error is not None:
316+
# Note that only the most recent error will be stored and raised
317+
raise error
318+
319+
# Otherwise, we got no results nor errors, implies the documentation doesn't exist
310320
return False
311321

312322

0 commit comments

Comments
 (0)