You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Services/InfoProviderSystem/Providers/MouserProvider.php
+7-1
Original file line number
Diff line number
Diff line change
@@ -177,7 +177,7 @@ public function getDetails(string $id): PartDetailDTO
177
177
}
178
178
179
179
if (count($tmp) > 1) {
180
-
thrownew \RuntimeException('Multiple parts found with ID '.$id);
180
+
thrownew \RuntimeException('Multiple parts found with ID '.$id . ' ('.count($tmp).' found). This is basically a bug in Mousers API response. See issue #616.');
181
181
}
182
182
183
183
return$tmp[0];
@@ -211,6 +211,12 @@ private function responseToDTOArray(ResponseInterface $response): array
211
211
$result = [];
212
212
foreach ($productsas$product) {
213
213
214
+
//Check if we have a valid product number. We assume that a product number, must have at least 4 characters
215
+
//Otherwise filter it out
216
+
if (strlen($product['MouserPartNumber']) < 4) {
217
+
continue;
218
+
}
219
+
214
220
//Check if we have a mass field available
215
221
$mass = null;
216
222
if (isset($product['UnitWeightKg']['UnitWeight'])) {
0 commit comments