@eko-ai/eko 1.2.4 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1227,6 +1227,9 @@ async function screenshot(chromeProxy, windowId, compress) {
1227
1227
  },
1228
1228
  };
1229
1229
  logger.debug('screenshot Got screenshot result:', result);
1230
+ if (!data || data.length < 30) {
1231
+ throw new Error('image error');
1232
+ }
1230
1233
  return result;
1231
1234
  }
1232
1235
  catch (e) {
@@ -1272,6 +1275,9 @@ async function compress_image(dataUrl, scale = 0.8, quality = 0.8) {
1272
1275
  logger.debug('Got compressed image result (sliced):', result.slice(0, 200));
1273
1276
  resolve(result);
1274
1277
  };
1278
+ reader.onerror = () => {
1279
+ resolve(dataUrl);
1280
+ };
1275
1281
  reader.readAsDataURL(blob);
1276
1282
  });
1277
1283
  }
@@ -1225,6 +1225,9 @@ async function screenshot(chromeProxy, windowId, compress) {
1225
1225
  },
1226
1226
  };
1227
1227
  logger.debug('screenshot Got screenshot result:', result);
1228
+ if (!data || data.length < 30) {
1229
+ throw new Error('image error');
1230
+ }
1228
1231
  return result;
1229
1232
  }
1230
1233
  catch (e) {
@@ -1270,6 +1273,9 @@ async function compress_image(dataUrl, scale = 0.8, quality = 0.8) {
1270
1273
  logger.debug('Got compressed image result (sliced):', result.slice(0, 200));
1271
1274
  resolve(result);
1272
1275
  };
1276
+ reader.onerror = () => {
1277
+ resolve(dataUrl);
1278
+ };
1273
1279
  reader.readAsDataURL(blob);
1274
1280
  });
1275
1281
  }