Skip to content

Commit 4bc3c2e

Browse files
authored
Merge pull request #19 from ashleykleynhans/master
Added additional error handling
2 parents 11e5dac + 64bd20d commit 4bc3c2e

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

flaskAlert.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,20 @@ def postAlertmanager():
4444
message += "Started: "+correctDate
4545
bot.sendMessage(chat_id=chatID, text=message)
4646
return "Alert OK", 200
47+
except RetryAfter:
48+
sleep(30)
49+
bot.sendMessage(chat_id=chatID, text=message)
50+
return "Alert OK", 200
51+
except TimedOut as e:
52+
sleep(60)
53+
bot.sendMessage(chat_id=chatID, text=message)
54+
return "Alert OK", 200
55+
except NetworkError as e:
56+
sleep(60)
57+
bot.sendMessage(chat_id=chatID, text=message)
58+
return "Alert OK", 200
4759
except Exception as error:
48-
bot.sendMessage(chat_id=chatID, text="Error to read json: "+str(error))
60+
bot.sendMessage(chat_id=chatID, text="Error: "+str(error))
4961
app.logger.info("\t%s",error)
5062
return "Alert fail", 200
5163

0 commit comments

Comments
 (0)