Closed Munter closed 10 years ago
Hmm, what if the graphicsmagick filter isn't the last in the chain? Eg. foo.png?resize=10,20&pngcrush
?
The change I made should still run all other filters if this specific error is encountered. I've set it at a warning level, which we might want to bump up to error instead if it isn't a good idea that the build keeps running after it encounters a missing gm install.
The important part of that patch is to catch the non-installed gm binary and give the user a message on how to resolve the problem instead of a cryptic stack trace. I have no strong feelings on wether we should stop with an error or keep going.
I understand the intention, and I agree that it's an improvement :). What I was referring to was that this error
handler should subscribe to all items in filters
, not just the last item:
filters[filters.length - 1]
.on('error', function (err) {
if (err.message === 'The gm stream ended without emitting any data') {
assetGraph.emit('warn', new Error('processImages: ' + imageAsset.url + '\nPlease install raphicsmagick to apply the following filters: ' + filtersAndTargetContentType.usedQueryStringFragments.join(', ')));
} else {
assetGraph.emit('error', err);
}
cb();
})
Hah, must have been a late night session :)
I'll take a look at fixing that later. Also I have a feeling I might have hooked into the wrong place. an error message about missing gm should probably be sent all the way from node-gm or express-processimage
This sees to be fixed. I must have forgotten to close the issue after making the change
I think we need to implement some error handling in
buildProduction
to give some better feedback to the user. It's non intuitive that they need to installgraphicsmagick
if they don't know thatgm
is the executable of that package.The same thing might apply for
inkscape