[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240403023426.1762996-3-kuba@kernel.org>
Date: Tue, 2 Apr 2024 19:34:21 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org,
edumazet@...gle.com,
pabeni@...hat.com,
shuah@...nel.org,
sdf@...gle.com,
donald.hunter@...il.com,
linux-kselftest@...r.kernel.org,
petrm@...dia.com,
Jakub Kicinski <kuba@...nel.org>,
jiri@...nulli.us
Subject: [PATCH net-next v2 2/7] tools: ynl: copy netlink error to NlError
Typing e.nl_msg.error when processing exception is a bit tedious
and counter-intuitive. Set a local .error member to the positive
value of the netlink level error.
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
CC: donald.hunter@...il.com
CC: jiri@...nulli.us
---
tools/net/ynl/lib/ynl.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
index 82d3c98067aa..b30210f537f7 100644
--- a/tools/net/ynl/lib/ynl.py
+++ b/tools/net/ynl/lib/ynl.py
@@ -100,9 +100,10 @@ from .nlspec import SpecFamily
class NlError(Exception):
def __init__(self, nl_msg):
self.nl_msg = nl_msg
+ self.error = -nl_msg.error
def __str__(self):
- return f"Netlink error: {os.strerror(-self.nl_msg.error)}\n{self.nl_msg}"
+ return f"Netlink error: {os.strerror(self.error)}\n{self.nl_msg}"
class ConfigError(Exception):
--
2.44.0
Powered by blists - more mailing lists