express-minify-html icon indicating copy to clipboard operation
express-minify-html copied to clipboard

Must be to Error handler

Open devalexqt opened this issue 6 years ago • 1 comments

In my scenario if html-minify has error then whole server is down! I think, that html-minify must be in try{...}catch(err){...} to prevent server down, and if err then return original html;

this code: ` var sendMinified = function (callback) {

  // No callback specified, just minify and send to client.
    if (typeof callback === 'undefined') {
      return function (err, html) {
        if (err) {
          return next(err);
        }

        html = minify(html, opts.htmlMinifier);<<<<<<<--------------  what if error occur???
        res.send(html);
      }
    } else {

      // Custom callback specified by user, use that one
      return function (err, html) {
        if (html) {
          html = minify(html, opts.htmlMinifier);<<<<<<<---------------  what if error occur???
        }

        callback(err, html);
      }
    }
};`

devalexqt avatar Jan 20 '19 01:01 devalexqt

This is fixed by #11

meszaros-lajos-gyorgy avatar Jul 19 '19 18:07 meszaros-lajos-gyorgy