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.
@@ -12119,7 +12119,14 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber, {
12119
12119
  body: searchData
12120
12120
  });
12121
12121
  if (!searchResponse.ok) {
12122
- throw new Error("Failed to search for the component");
12122
+ if (searchResponse.status === 403) {
12123
+ throw new Error(
12124
+ `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.`
12125
+ );
12126
+ }
12127
+ throw new Error(
12128
+ `Failed to search for the component (HTTP ${searchResponse.status})`
12129
+ );
12123
12130
  }
12124
12131
  const searchResult = await searchResponse.json();
12125
12132
  if (!searchResult.success || !searchResult.result.lists.lcsc.length) {
@@ -12137,7 +12144,14 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber, {
12137
12144
  }
12138
12145
  });
12139
12146
  if (!componentResponse.ok) {
12140
- throw new Error("Failed to fetch the component details");
12147
+ if (componentResponse.status === 403) {
12148
+ throw new Error(
12149
+ `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.`
12150
+ );
12151
+ }
12152
+ throw new Error(
12153
+ `Failed to fetch the component details (HTTP ${componentResponse.status})`
12154
+ );
12141
12155
  }
12142
12156
  const componentResult = await componentResponse.json();
12143
12157
  const result = componentResult.result;