summaryrefslogtreecommitdiff
path: root/ATRI/utils/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'ATRI/utils/__init__.py')
-rw-r--r--ATRI/utils/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ATRI/utils/__init__.py b/ATRI/utils/__init__.py
index 328f1ad..a6526c2 100644
--- a/ATRI/utils/__init__.py
+++ b/ATRI/utils/__init__.py
@@ -128,6 +128,13 @@ class FileDealer:
async def write(self, content):
try:
async with aiofiles.open(self.path, "w", encoding=self.encoding) as target:
+ await target.write(content)
+ except Exception:
+ raise Exception(f"Writing file ({self.path}) failed!")
+
+ async def write_json(self, content):
+ try:
+ async with aiofiles.open(self.path, "w", encoding=self.encoding) as target:
await target.write(json.dumps(content))
except Exception:
raise Exception(f"Writing file ({self.path}) failed!")