From 870b626fb2467e9c6a98978da40ccf9196215a81 Mon Sep 17 00:00:00 2001 From: harshadkhetpal Date: Mon, 20 Apr 2026 10:39:25 +0530 Subject: [PATCH] fix: replace bare except with except Exception in EnvironmentGetByEquipResource MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace bare `except:` clause with `except Exception:` on line 79. A bare `except:` catches all exceptions including `SystemExit`, `KeyboardInterrupt`, and `GeneratorExit`, which can mask critical errors and make debugging harder. Since this block simply sets a fallback value without re-raising, `except Exception:` is the correct fix (PEP 8 E722). No behavioral change for normal operation — only system-level exceptions are no longer silently swallowed. --- networkapi/ambiente/resource/EnvironmentGetByEquipResource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/networkapi/ambiente/resource/EnvironmentGetByEquipResource.py b/networkapi/ambiente/resource/EnvironmentGetByEquipResource.py index ca2af0912..ea75ee2c9 100644 --- a/networkapi/ambiente/resource/EnvironmentGetByEquipResource.py +++ b/networkapi/ambiente/resource/EnvironmentGetByEquipResource.py @@ -76,7 +76,7 @@ def handle_get(self, request, user, *args, **kwargs): if env.min_num_vlan_1 != env.min_num_vlan_2: env_map['range'] = env_map[ 'range'] + '; ' + str(env.min_num_vlan_2) + ' - ' + str(env.max_num_vlan_2) - except: + except Exception: env_map['range'] = 'Nao definido' if env.filter is not None: