Skip to content

Commit b1bd292

Browse files
Merge pull request #53 from bugout-dev/fix-connection-error-handling
Fix error handling.
2 parents e45589e + 1cd42f0 commit b1bd292

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

bugout/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
__email__ = "engineering@bugout.dev"
99
__license__ = "MIT"
10-
__version__ = "0.2.12"
10+
__version__ = "0.2.13"
1111

1212
__all__ = (
1313
"__author__",

bugout/calls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def make_request(method: Method, url: str, **kwargs) -> Any:
1212
response.raise_for_status()
1313
except requests.exceptions.RequestException as err:
1414
r = err.response
15-
if not err.response:
15+
if err.response is None:
1616
# Connection errors, timepouts, etc...
1717
raise BugoutResponseException(
1818
"Network error", status_code=599, detail=str(err)

bugout/jobs.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88
from enum import Enum
99
import json
1010
import os
11-
import requests
11+
import requests # type: ignore
1212
from typing import Callable, Optional, List
1313

1414
from .app import Bugout
15-
from .data import AuthType, BugoutSearchResultWithEntryID
15+
from .data import (
16+
AuthType,
17+
BugoutSearchResultWithEntryID,
18+
BugoutSearchResult,
19+
BugoutSearchResult,
20+
)
1621
from .journal import SearchOrder
1722
from .settings import BUGOUT_BROOD_URL, BUGOUT_SPIRE_URL, REQUESTS_TIMEOUT
1823

@@ -175,7 +180,10 @@ def list_jobs(
175180

176181
results = [
177182
BugoutSearchResultWithEntryID(
178-
**dict(raw_result), id=raw_result.entry_url.split("/")[-1]
183+
**dict(raw_result),
184+
id=raw_result.entry_url.split("/")[-1]
185+
if isinstance(raw_result, BugoutSearchResult)
186+
else raw_result.entity_url.split("/")[-1],
179187
)
180188
for raw_result in job_results.results
181189
]

0 commit comments

Comments
 (0)