From 9634364b2065e90c16c46ef9d02f80a60b943ed2 Mon Sep 17 00:00:00 2001
From: Andreas Domanowski <andreas@domanowski.net>
Date: Thu, 2 Mar 2023 11:52:46 +0100
Subject: [PATCH] Add rudimentary error handling to POST requests

---
 import_md/hedgedoc_import.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/import_md/hedgedoc_import.py b/import_md/hedgedoc_import.py
index 0b4a3aa..72a6838 100644
--- a/import_md/hedgedoc_import.py
+++ b/import_md/hedgedoc_import.py
@@ -77,6 +77,8 @@ def process_archive_export(archive_file, instance_url, lookup_map, session_id, u
                               "creating a new, random path")
                         new_url = import_single_document(instance_url, "", document_content, session_id)
                         print(f"New URL after document migration without migrating the URL/subpath: {new_url}")
+                    else:
+                        raise SystemExit("Could not create document. Please check your session cookie. Aborting...")
                 urls_to_visit.append(new_url)
                 print()
             else:
-- 
GitLab