UNPKG

astro

Version:

Astro is a modern site builder with web best practices, performance, and DX front-of-mind.

18 lines (17 loc) • 534 B
import { AstroError, AstroErrorData } from "../../../core/errors/index.js"; export function createGetFontFileURL(runtimeFontFileUrlResolver) { return function getFontFileURL(url, requestUrl) { try { const result = runtimeFontFileUrlResolver.resolve(url, requestUrl); if (result === null) { throw new Error("Not found"); } return result; } catch (cause) { throw new AstroError({ ...AstroErrorData.FontFileUrlNotFound, message: AstroErrorData.FontFileUrlNotFound.message(url) }, { cause }); } }; }