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.
This commit is contained in:
parent
af59b6147e
commit
77e7c9ca93
@ -3601,11 +3601,8 @@ class OOMAnalyser:
|
|||||||
|
|
||||||
def _calc_swap_values(self):
|
def _calc_swap_values(self):
|
||||||
"""Calculate all swap related values"""
|
"""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
|
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:
|
if not self.oom_result.swap_active:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user