@arbidocs/sdk 0.3.50 → 0.3.52

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.
package/dist/index.cjs CHANGED
@@ -5220,7 +5220,17 @@ async function retrieve(options) {
5220
5220
  };
5221
5221
  const { data, error } = await arbi.fetch.POST("/v1/assistant/retrieve", { body });
5222
5222
  if (error) {
5223
- throw new Error(`Retrieve failed: ${JSON.stringify(error)}`);
5223
+ const detail = error?.detail;
5224
+ let message;
5225
+ if (typeof detail === "string") {
5226
+ message = detail;
5227
+ } else if (detail && typeof detail === "object") {
5228
+ const d2 = detail;
5229
+ message = typeof d2.hint === "string" && d2.hint || JSON.stringify(detail);
5230
+ } else {
5231
+ message = JSON.stringify(error);
5232
+ }
5233
+ throw new Error(`Retrieve failed: ${message}`);
5224
5234
  }
5225
5235
  return data;
5226
5236
  }