Is there a way to catch 404 error ?
impestdev opened this issue · comments
FYI for anyone else looking I got this working with this:
const fetchFont = async (fontName: string) => {
try {
const promise = new Promise((resolve, reject) => {
WebFont.load({
google: { families: [fontName] },
active: () => resolve("true"),
inactive: () => reject("404"),
})
})
await promise
.....
} catch (err) {
console.log("HAS ERR", err)
.....
}
}