From dbfaaeb4c9e6425c6b546c86ad0bd29493b6fa44 Mon Sep 17 00:00:00 2001 From: Luxferre Date: Sun, 21 Dec 2025 11:36:08 +0200 Subject: [PATCH] added useful exception info to ed --- app/ed.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/ed.py b/app/ed.py index e21a326..ccc55fb 100644 --- a/app/ed.py +++ b/app/ed.py @@ -162,7 +162,7 @@ class Ed: sep = params[0] parts = params.split(sep) if len(parts) < 3: - print("?") + print("Invalid s/old/new syntax") continue old, new = parts[1], parts[2] start = max(1, start) @@ -176,7 +176,7 @@ class Ed: elif cmd_char == 'w': target = params if params else self.filename if not target: - print("?") + print("No target file to write to") continue with open(target, "w") as f: for line in self.buffer: @@ -191,10 +191,10 @@ class Ed: print(self.filename if self.filename else "No current filename") else: - print("?") + print("Unknown command") - except Exception: - print("?") + except Exception as e: + print(f"Exception occurred: {e}") def edit(fname): editor = Ed(fname)