From 22f3e71cac0bd660ce7a5fa1b4173642f348e7bf Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Sun, 10 Nov 2024 17:51:12 +0000 Subject: [PATCH] Some tidying --- src/posting/app.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/posting/app.py b/src/posting/app.py index 3f470e50..b5ba837f 100644 --- a/src/posting/app.py +++ b/src/posting/app.py @@ -696,23 +696,21 @@ def build_request_model(self, request_options: Options) -> RequestModel: def on_curl_message(self, event: CurlMessage): try: curl_import = CurlImport(event.curl_command) - except SystemExit: + request_model = curl_import.to_request_model() + except Exception as e: self.notify( title="Could not parse curl request", - message="An error occurred while parsing the curl request.", + message=f"An error occurred: {e}", timeout=5, severity="error", ) - return - - request_model = curl_import.to_request_model() - self.load_request_model(request_model) - - self.notify( - title="Curl request imported", - message=f"Successfully imported curl request to {curl_import.url}", - timeout=3, - ) + else: + self.load_request_model(request_model) + self.notify( + title="Curl request imported", + message=f"Successfully imported curl request to {curl_import.url}", + timeout=3, + ) def load_request_model(self, request_model: RequestModel) -> None: """Load a request model into the UI."""