screenshots: Put try catch inside jimp promise

Change-Id: I3c72f024f740a2af882a7651c77ba017ad2e2e97
This commit is contained in:
Ed Sanders 2020-06-26 21:44:31 +01:00
parent 57faec4353
commit a6d0ca80cf

View file

@ -66,16 +66,16 @@ function createScreenshotEnvironment( test ) {
const right = Math.min( clientSize.width, rect.left + rect.width + padding );
const bottom = Math.min( clientSize.height, rect.top + rect.height + padding );
try {
return Jimp.read( imageBuffer ).then( function ( jimpImage ) {
return Jimp.read( imageBuffer ).then( function ( jimpImage ) {
try {
jimpImage
.crop( left, top, right - left, bottom - top )
.write( filename );
} );
} catch ( e ) {
// Log error (memory?)
console.error( e );
}
} catch ( e ) {
// Log error (memory?)
console.error( e );
}
} );
}
function runScreenshotTest( name, lang, clientScript, padding ) {