easyeda 0.0.275 → 0.0.276

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.js CHANGED
@@ -6591,7 +6591,14 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber, {
6591
6591
  body: searchData
6592
6592
  });
6593
6593
  if (!searchResponse.ok) {
6594
- throw new Error("Failed to search for the component");
6594
+ if (searchResponse.status === 403) {
6595
+ throw new Error(
6596
+ `EasyEDA API rate limit exceeded while searching for "${jlcpcbPartNumber}" (HTTP 403). EasyEDA rate-limits by IP \u2014 the part number is likely fine. Wait ~2 minutes and try again.`
6597
+ );
6598
+ }
6599
+ throw new Error(
6600
+ `Failed to search for the component (HTTP ${searchResponse.status})`
6601
+ );
6595
6602
  }
6596
6603
  const searchResult = await searchResponse.json();
6597
6604
  if (!searchResult.success || !searchResult.result.lists.lcsc.length) {
@@ -6609,7 +6616,14 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber, {
6609
6616
  }
6610
6617
  });
6611
6618
  if (!componentResponse.ok) {
6612
- throw new Error("Failed to fetch the component details");
6619
+ if (componentResponse.status === 403) {
6620
+ throw new Error(
6621
+ `EasyEDA API rate limit exceeded while fetching "${jlcpcbPartNumber}" (HTTP 403). EasyEDA rate-limits by IP \u2014 the part number is likely fine. Wait ~2 minutes and try again.`
6622
+ );
6623
+ }
6624
+ throw new Error(
6625
+ `Failed to fetch the component details (HTTP ${componentResponse.status})`
6626
+ );
6613
6627
  }
6614
6628
  const componentResult = await componentResponse.json();
6615
6629
  const result = componentResult.result;