@eyepop.ai/eyepop 1.9.0 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11158,17 +11158,19 @@ var DataEndpoint = class extends Endpoint {
11158
11158
  if (response.status === 204) {
11159
11159
  return null;
11160
11160
  }
11161
+ const contentType = response.headers.get("Content-Type");
11162
+ this._requestLogger.debug("Response - " + response.status + " " + response.statusText);
11161
11163
  if (!response.ok) {
11162
- const errorData = await response.json();
11163
- throw new Error(errorData.detail || "Request failed");
11164
+ if (contentType && (contentType.toLowerCase().startsWith("application/json") || contentType.toLowerCase().startsWith("text/"))) {
11165
+ throw new Error(`Request failed with ${response.status} ${response.statusText}: ${await response.text()}`);
11166
+ } else {
11167
+ throw new Error(`Request failed with ${response.status} ${response.statusText}`);
11168
+ }
11164
11169
  }
11165
- const contentType = response.headers.get("Content-Type");
11166
- if (contentType && contentType.startsWith("image/")) {
11167
- const blob = await response.blob();
11168
- return blob;
11170
+ if (contentType && contentType.toLowerCase().startsWith("application/json")) {
11171
+ return await response.json();
11169
11172
  }
11170
- this._requestLogger.debug("Response - " + response.status + " " + response.statusText);
11171
- return response.json();
11173
+ return await response.blob();
11172
11174
  }
11173
11175
  async listDatasets(include_stats = true, modifiable_version_only) {
11174
11176
  const modifiableVersionQuery = typeof modifiable_version_only !== "undefined" ? `&modifiable_version_only=${modifiable_version_only}` : "";