Gemlog Booster [capsule]

Report exceptions to client as errors

=> dc77f3eac12461befeb164aac612492b0e87b3b1

diff --git a/booster.py b/booster.py
index 1895ff9..45e7655 100755
--- a/booster.py
+++ b/booster.py
@@ -17,7 +17,7 @@
 # 2. Redistributions in binary form must reproduce the above copyright notice,
 #    this list of conditions and the following disclaimer in the documentation
 #    and/or other materials provided with the distribution.
-# 
+#
 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -55,7 +55,7 @@ print(json.dumps(CONFIG, indent=2))
 
 def report_error(stream, code, msg):
     stream.sendall(f'{code} {msg}\r\n'.encode('utf-8'))
-    
+
 def run_command(args):
     try:
         out = subprocess.check_output(args).decode('utf-8').strip()
@@ -67,14 +67,14 @@ def run_command(args):
     if len(out):
         return '```\n' + out + '\n```\n'
     return ''
-    
+
 def urlenc(q):
     q = q.replace(' ', '%20')
     q = q.replace(':', '%3A')
     q = q.replace('/', '%2F')
-    return q    
+    return q
 
-def handle_client(stream):    
+def handle_client(stream):
     data = bytes()
     incoming = stream.recv(1024)
     #der = stream.getpeercert(binary_form=True)
@@ -186,7 +186,9 @@ while True:
         import traceback
         traceback.print_exc()
         print('\n-=-=- We have a problem -=-=-\n')
-        print(ex)        
+        print(ex)
+        if stream:
+            report_error(stream, 42, str(ex))
     finally:
         if stream:
             stream.shutdown(socket.SHUT_RDWR)
Proxy Information
Original URL
gemini://git.skyjake.fi/booster/capsule/cdiff/dc77f3eac12461befeb164aac612492b0e87b3b1
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
23.32472 milliseconds
Gemini-to-HTML Time
0.187988 milliseconds

This content has been proxied by September (3851b).