Use new signature for onTileErrorStrategy

This commit is contained in:
Daniel García Aubert
2020-03-27 19:38:28 +01:00
parent 7a1d84a3fb
commit 4054c6923f
2 changed files with 6 additions and 8 deletions
+4 -6
View File
@@ -296,9 +296,9 @@ const timeoutErrorTilePath = path.join(__dirname, '/../../assets/render-timeout-
const timeoutErrorTile = require('fs').readFileSync(timeoutErrorTilePath, { encoding: null });
function createRendererFactory ({ redisPool, serverOptions, environmentOptions }) {
var onTileErrorStrategy;
let onTileErrorStrategy;
if (environmentOptions.enabledFeatures.onTileErrorStrategy !== false) {
onTileErrorStrategy = function onTileErrorStrategy$TimeoutTile (err, tile, headers, stats, format, callback) {
onTileErrorStrategy = async function onTileErrorStrategy$TimeoutTile (err, format) {
function isRenderTimeoutError (err) {
return err.message === 'Render timed out';
}
@@ -316,11 +316,9 @@ function createRendererFactory ({ redisPool, serverOptions, environmentOptions }
}
if (isTimeoutError(err) && isRasterFormat(format)) {
return callback(null, timeoutErrorTile, {
'Content-Type': 'image/png'
}, {});
return { buffer: timeoutErrorTile, headers: { 'Content-Type': 'image/png' }, stats: {} };
} else {
return callback(err, tile, headers, stats);
throw err;
}
};
}