[projects/pld-builder.new] log: raise a dedicated Panic exception from panic()
arekm
arekm at pld-linux.org
Mon Oct 26 17:15:30 CET 2026
commit 90c76973e29913b4b2daf5b0d45a5d74d28a9228
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sat Oct 24 14:53:44 2026 +0200
log: raise a dedicated Panic exception from panic()
Lets callers catch a panic without catching everything else.
PLD_Builder/log.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/PLD_Builder/log.py b/PLD_Builder/log.py
index f4529fa..e0b6092 100644
--- a/PLD_Builder/log.py
+++ b/PLD_Builder/log.py
@@ -27,9 +27,12 @@ def log(p, s):
f.write("%s [%s]: %s [%s]\n" % (time.asctime(), builder, s, os.path.basename(sys.argv[0])))
f.close()
+class Panic(Exception):
+ pass
+
def panic(s):
log(syslog.LOG_ALERT, "PANIC: %s" % s)
- raise Exception("PANIC: %s" % str(s))
+ raise Panic("PANIC: %s" % str(s))
def alert(s):
log(syslog.LOG_ALERT, "alert: %s" % s)
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/ce9feb3c796ed049b6dd260a50d94d80feb1656d
More information about the pld-cvs-commit
mailing list