Better error handling

This commit is contained in:
mahdium committed 2024-12-20 23:03:38 +03:30
1 parent e1b4cb65f3
commit aa2feea611
2 files changed
+6

No files matched your search

+1
View File
@@ -5,3 +5,4 @@ obj/
*.json
.env
data/
Folder.DotSettings.user
+5
View File
@@ -16,6 +16,7 @@ public class HandleDbBackup
{
logger?.LogInformation("Backup requested");
try{
var json = (await _db.Find(new BsonDocument()).ToListAsync()).ToJson();
var bytes = Encoding.UTF8.GetBytes(json);
@@ -27,4 +28,8 @@ public class HandleDbBackup
ParseMode.Html);
logger?.LogInformation("Backup sent");
}
catch(Exception ex){
logger?.LogError(ex,"Unable to backup database");
}
}
}