From 2869c2d4214df7227297bfc1cd0e61f794fb2388 Mon Sep 17 00:00:00 2001 From: harshadkhetpal Date: Mon, 20 Apr 2026 10:54:53 +0530 Subject: [PATCH] fix: replace bare except with except Exception in v1.py Replace bare `except:` with `except Exception:` in _load_template_file (line 597). Bare `except:` catches all exceptions including SystemExit, KeyboardInterrupt, and GeneratorExit, which can mask critical errors and make debugging harder (PEP 8 E722). Since this block handles a fallback case without re-raising the original exception, `except Exception:` is the correct narrower alternative. No behavioral change for normal operation. --- networkapi/api_network/facade/v1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/networkapi/api_network/facade/v1.py b/networkapi/api_network/facade/v1.py index a8ea2765..2cdd3e11 100644 --- a/networkapi/api_network/facade/v1.py +++ b/networkapi/api_network/facade/v1.py @@ -594,7 +594,7 @@ def _load_template_file(equipment, template_type): try: equipment_template = (EquipamentoRoteiro.search( None, equipment.id, template_type)).uniqueResult() - except: + except Exception: log.error('Template type %s not found.' % template_type) raise exceptions.NetworkTemplateException()