Skip to content

Commit 4236756

Browse files
author
Zach Banks
committed
MOD: Expose BentoError in client library
1 parent d1d31ce commit 4236756

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

databento/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,22 @@
33
from databento.common.bento import Bento, FileBento, MemoryBento
44
from databento.historical.api import API_VERSION
55
from databento.historical.client import Historical
6+
from databento.historical.error import (
7+
BentoClientError,
8+
BentoError,
9+
BentoHttpError,
10+
BentoServerError,
11+
)
612
from databento.version import __version__ # noqa
713

814

915
__all__ = [
1016
"API_VERSION",
1117
"Bento",
18+
"BentoClientError",
19+
"BentoError",
20+
"BentoHttpError",
21+
"BentoServerError",
1222
"FileBento",
1323
"Historical",
1424
"MemoryBento",

databento/historical/error.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ def __init__(
3333
self.http_status = http_status
3434
self.http_body = http_body
3535
self.json_body = json_body
36-
self._message = message
36+
self.message = message
3737
self.headers = headers or {}
3838
self.request_id = self.headers.get("request-id", None)
3939

4040
def __str__(self):
41-
msg = self._message or "<empty message>"
41+
msg = self.message or "<empty message>"
4242
msg = f"{self.http_status} {msg}"
4343
if self.request_id is not None:
4444
return f"Request {self.request_id}: {msg}"
@@ -50,7 +50,7 @@ def __repr__(self):
5050
f"{type(self).__name__}("
5151
f"request_id={self.request_id}, "
5252
f"http_status={self.http_status}, "
53-
f"message={self._message})"
53+
f"message={self.message})"
5454
)
5555

5656

0 commit comments

Comments
 (0)