figlet.js icon indicating copy to clipboard operation
figlet.js copied to clipboard

Unable to handle errors with preloadFonts

Open MarketingPip opened this issue 1 year ago • 2 comments

In

  me.preloadFonts = function (fonts, next) {

I am unable to handle thrown errors from invalid font names fetched....

MarketingPip avatar Oct 01 '24 07:10 MarketingPip

I am stupid - I could do this but still seems like it should be handled with preload too..

  try{
 const standard =  (await import(`https://esm.sh/figlet/importable-fonts/${options.font}.js`)).default       
                        
figlet.parseFont(options.font, standard); 
        }catch(err){
          throw err
        }

MarketingPip avatar Oct 01 '24 07:10 MarketingPip

This sounds like bug, if fetch fail to get the font it should call next() with an error.

jcubic avatar Oct 08 '24 14:10 jcubic

Fixed this method for version 1.9.0 so that errors can correctly be handled.

patorjk avatar Sep 08 '25 02:09 patorjk