]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
httpserver: add error handler that write to the logger
authorRoss Burton <ross.burton@arm.com>
Tue, 31 Jan 2023 16:30:22 +0000 (16:30 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 1 Feb 2023 13:59:56 +0000 (13:59 +0000)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/utils/httpserver.py

index 2aa172bf79961c76dc41de62aba76c0a2df5da51..80752c137707eec9fc34eb83e850b8a5bb606f34 100644 (file)
@@ -44,6 +44,12 @@ class HTTPService:
             self.port = self.server.server_port
         self.process = multiprocessing.Process(target=self.server.server_start, args=[self.root_dir, self.logger])
 
+        def handle_error(self, request, client_address):
+            import traceback
+            exception = traceback.format_exc()
+            self.logger.warn("Exception when handling %s: %s" % (request, exception))
+        self.server.handle_error = handle_error
+
         # The signal handler from testimage.bbclass can cause deadlocks here
         # if the HTTPServer is terminated before it can restore the standard 
         #signal behaviour