Skip to content

Commit

Permalink
added error tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Szer committed Jan 22, 2024
1 parent d427835 commit 3e1a3c8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/VahterBanBot/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,21 @@ let webApp = choose [
let updateBodyJson =
try JsonConvert.SerializeObject update
with e -> e.Message
use banOnReplyActivity =
use topActivity =
botActivity
.StartActivity("postUpdate")
.SetTag("updateBodyObject", update)
.SetTag("updateBodyJson", updateBodyJson)

banOnReplyActivity.SetCustomProperty("updateBodyObject", update)
banOnReplyActivity.SetCustomProperty("updateBodyJson", updateBodyJson)


use scope = ctx.RequestServices.CreateScope()
let telegramClient = scope.ServiceProvider.GetRequiredService<ITelegramBotClient>()
let logger = ctx.GetLogger<Root>()
try
do! onUpdate telegramClient botConf (ctx.GetLogger "VahterBanBot.Bot") update.Message
%topActivity.SetTag("update-error", false)
with e ->
logger.LogError(e, $"Unexpected error while processing update: {updateBodyJson}")
%topActivity.SetTag("update-error", true)

return! Successful.OK() next ctx
})
Expand Down

0 comments on commit 3e1a3c8

Please sign in to comment.