Update utils.js

This commit is contained in:
acalcutt 2025-01-05 02:30:21 -05:00
parent 62a3212629
commit 5de617dfe2

View file

@ -223,10 +223,7 @@ async function getFontPbf(allowedFonts, fontPath, name, range, fallbacks) {
}
if (!/^\d+-\d+$/.test(sRange)) {
console.error(
'ERROR: Invalid range: %s',
sanitizedRange.replace(/\n|\r/g, ''),
);
console.error('ERROR: Invalid range: %s', sRange);
throw new Error('Invalid range');
}
@ -242,7 +239,7 @@ async function getFontPbf(allowedFonts, fontPath, name, range, fallbacks) {
} catch (err) {
console.error(
'ERROR: Font not found: %s, Error: %s',
filename.replace(/\n|\r/g, ''),
filename,
String(err),
);
if (fallbacks && Object.keys(fallbacks).length) {
@ -262,7 +259,7 @@ async function getFontPbf(allowedFonts, fontPath, name, range, fallbacks) {
console.error(
`ERROR: Trying to use %s as a fallback for: %s`,
fallbackName,
sanitizedName,
sFontStack,
);
delete fallbacks[fallbackName];
return getFontPbf(null, fontPath, fallbackName, range, fallbacks);