Skip to content

Commit 9409532

Browse files
author
Kevin Scott
committed
Only throw error if no images were returned
1 parent d49185c commit 9409532

File tree

3 files changed

+15
-34
lines changed

3 files changed

+15
-34
lines changed

package-lock.json

Lines changed: 12 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ml-classifier",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "A machine learning engine for quickly training image classification models in your browser",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class MLClassifier {
215215
images,
216216
errors,
217217
} = await translateImages([origImage], dims);
218-
if (errors && errors.length) {
218+
if (errors && errors.length && !images[0]) {
219219
throw errors[0].error;
220220
}
221221
const data = images[0];
@@ -240,7 +240,7 @@ class MLClassifier {
240240
return prediction;
241241
} catch(err) {
242242
console.error(err, origImage, label);
243-
throw new Error(err);
243+
// throw new Error(err);
244244
}
245245
}
246246

0 commit comments

Comments
 (0)