From 4c35ffdd908d56910ade0439626b7cffa9dfa347 Mon Sep 17 00:00:00 2001 From: Robert George Date: Tue, 14 Sep 2021 17:18:58 -0700 Subject: [PATCH] Better handling GV failure --- ddb.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ddb.js b/ddb.js index 82bace1..1dce499 100644 --- a/ddb.js +++ b/ddb.js @@ -1799,8 +1799,8 @@ function displayModal(path,id) { let tasks = [] const headings = dom.window.document.querySelectorAll("h1, h2, h3, h4, h5, h6") prog.detail = `Found Map - ${mapTitle} - Scanning for markers with Google Vision` - const ocrResult = await this.gVisionClient.textDetection(dmMapImg).catch(e=>console.log(`Error submitting ${dmMap} (${typeof(dmMap)}) to Google Vision: ${e}`)) - ocrResult[0]?.textAnnotations?.forEach((word,i)=>{ + const [ocrResult] = await this.gVisionClient.textDetection(dmMapImg).catch(e=>console.log(`Error submitting ${dmMap} (${typeof(dmMap)}) to Google Vision: ${e}`)) + ocrResult?.textAnnotations?.forEach((word,i)=>{ let txt = word.description.replaceAll(/[\W_]+/g,'').trim(); let box = word.boundingPoly.vertices let x = box[0].x, y = box[0].y diff --git a/package.json b/package.json index b260ac0..3f5ea47 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "encounterlog", "productName": "EncounterLog", - "version": "2.1.6", + "version": "2.1.7", "description": "Connect D&D Beyond to EncounterPlus", "repository": { "type": "git",