Skip to content

Commit

Permalink
Update utils.js
Browse files Browse the repository at this point in the history
  • Loading branch information
acalcutt committed Jan 5, 2025
1 parent 62a3212 commit 5de617d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand All @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit 5de617d

Please sign in to comment.