mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
catch ocr errors
This commit is contained in:
parent
7651738ae8
commit
46c9164a7e
2 changed files with 14 additions and 4 deletions
|
@ -18,8 +18,13 @@ module.exports = {
|
|||
let image = await getRecentImage(context, 50)
|
||||
if (!image) return editOrReply(context, { embeds: [createEmbed("warning", context, "No images found.")] })
|
||||
|
||||
let ocr = await googleVisionOcr(context, image)
|
||||
|
||||
let ocr;
|
||||
try{
|
||||
ocr = await googleVisionOcr(context, image)
|
||||
}catch(e){
|
||||
return editOrReply(context, { embeds: [createEmbed("error", context, "Unable to retrieve Google Vision API response.")] })
|
||||
}
|
||||
|
||||
if(ocr.response.body.status == 1) return editOrReply(context, { embeds: [createEmbed("warning", context, ocr.response.body.message)] })
|
||||
|
||||
return editOrReply(context, createEmbed("default", context, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue