Skip to content

Commit c398f77

Browse files
authored
Merge pull request #78 from scaleapi/da-api-error-message
Nudge more for upgrades
2 parents 1a2eaa8 + adf9179 commit c398f77

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ Nucleus is a new way—the right way—to develop ML models, helping us move awa
1717

1818
`$ pip install scale-nucleus`
1919

20+
## Common issues/FAQ
21+
22+
### Outdated Client
23+
24+
Nucleus is iterating rapidly and as a result we do not always perfectly preserve backwards compatibility with older versions of the client. If you run into any unexpected error, it's a good idea to upgrade your version of the client by running
25+
```
26+
pip install --upgrade scale-nucleus
27+
```
28+
2029
## Usage
2130

2231
The first step to using the Nucleus library is instantiating a client object.

nucleus/errors.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
import pkg_resources
2+
3+
nucleus_client_version = pkg_resources.get_distribution(
4+
"scale-nucleus"
5+
).version
6+
7+
18
class ModelCreationError(Exception):
29
def __init__(self, message="Could not create the model"):
310
self.message = message
@@ -28,9 +35,9 @@ class NucleusAPIError(Exception):
2835
def __init__(
2936
self, endpoint, command, requests_response=None, aiohttp_response=None
3037
):
31-
38+
message = f"Your client is on version {nucleus_client_version}. Before reporting this error, please make sure you update to the latest version of the client by running pip install --upgrade scale-nucleus\n"
3239
if requests_response is not None:
33-
message = f"Tried to {command.__name__} {endpoint}, but received {requests_response.status_code}: {requests_response.reason}."
40+
message += f"Tried to {command.__name__} {endpoint}, but received {requests_response.status_code}: {requests_response.reason}."
3441
if hasattr(requests_response, "text"):
3542
if requests_response.text:
3643
message += (
@@ -39,7 +46,7 @@ def __init__(
3946

4047
if aiohttp_response is not None:
4148
status, reason, data = aiohttp_response
42-
message = f"Tried to {command.__name__} {endpoint}, but received {status}: {reason}."
49+
message += f"Tried to {command.__name__} {endpoint}, but received {status}: {reason}."
4350
if data:
4451
message += f"\nThe detailed error is:\n{data}"
4552

0 commit comments

Comments
 (0)