From d0d5c596fbcd349e5d4345acf9d8bc2fa8cf5238 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 3 Mar 2022 13:04:42 +0100 Subject: [PATCH] When `stopAtErrors` is set, throw rather than warn when exceeding `maxImageSize` (issue 14626) The situation described in issue 14626 seems like a fairly special case, and it thus seem reasonable that we simply follow the same pattern as elsewhere in the `PartialEvaluator` when the `stopAtErrors` API-option is being used. --- src/core/evaluator.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/evaluator.js b/src/core/evaluator.js index cb40b94cf..a71adacfe 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -576,8 +576,13 @@ class PartialEvaluator { } const maxImageSize = this.options.maxImageSize; if (maxImageSize !== -1 && w * h > maxImageSize) { - warn("Image exceeded maximum allowed size and was removed."); - return; + const msg = "Image exceeded maximum allowed size and was removed."; + + if (this.options.ignoreErrors) { + warn(msg); + return; + } + throw new Error(msg); } let optionalContent;