Skip to content

[PLT-821][PLT-822] Throw user readable errors when creating a custom embedding. #1644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion libs/labelbox/src/labelbox/adv_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
from typing import Dict, Any, Optional, List, Callable
from urllib.parse import urlparse
from labelbox.exceptions import LabelboxError

import requests
from requests import Session, Response
Expand Down Expand Up @@ -59,7 +60,12 @@ def _request(self,
url,
data=requests_data,
headers=headers)
response.raise_for_status()
if response.status_code != requests.codes.ok:
message = response.json().get('message')
if message:
raise LabelboxError(message)
else:
response.raise_for_status()
return response.json()

def _send_ndjson(self,
Expand Down
Loading