[api-minor] Remove the image-related error message prefixes

Other custom errors, based on `BaseException`, do not use such a format.
This commit is contained in:
Jonas Jenwald 2024-04-20 12:48:33 +02:00
parent 5ad42c13ad
commit 912b57b95d
8 changed files with 33 additions and 15 deletions

View file

@ -1,4 +1,5 @@
import {
JpegError,
JpegImage,
setVerbosityLevel,
VerbosityLevel,
@ -7,9 +8,12 @@ import {
// Avoid unnecessary console "spam", by ignoring `info`/`warn` calls.
setVerbosityLevel(VerbosityLevel.ERRORS);
const ignored = ["Cannot read properties", "JPEG error"];
const ignored = ["Cannot read properties"];
function ignoredError(error) {
if (error instanceof JpegError) {
return true;
}
return ignored.some(message => error.message.includes(message));
}