From 77e7c9ca93f45305b089da2678ae0407d1d4bfd6 Mon Sep 17 00:00:00 2001 From: Carsten Grohmann Date: Wed, 29 Mar 2023 20:46:01 +0200 Subject: [PATCH] Replace except KeyError with if in for better JS Catching a Python-like exeption like KeyError doesn't work well after compiling to JavaScript with Transcrypt. --- OOMAnalyser.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OOMAnalyser.py b/OOMAnalyser.py index af58e8a..0bb2d7c 100644 --- a/OOMAnalyser.py +++ b/OOMAnalyser.py @@ -3601,11 +3601,8 @@ class OOMAnalyser: def _calc_swap_values(self): """Calculate all swap related values""" - try: + if "swap_total_kb" in self.oom_result.details: self.oom_result.swap_active = self.oom_result.details["swap_total_kb"] > 0 - except KeyError: - self.oom_result.swap_active = False - if not self.oom_result.swap_active: return