diff options
| author | Jakub Kicinski <[email protected]> | 2024-04-03 02:34:21 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2024-04-04 17:33:52 +0000 |
| commit | b269d2b4a5232c6130b5df83fb112f4029df4544 (patch) | |
| tree | 43f3755fc3ffc3fcc8a297641678f8c6d7f7aad2 /tools/net/ynl/lib/ynl.py | |
| parent | netlink: specs: define ethtool header flags (diff) | |
| download | kernel-b269d2b4a5232c6130b5df83fb112f4029df4544.tar.gz kernel-b269d2b4a5232c6130b5df83fb112f4029df4544.zip | |
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.
Reviewed-by: Petr Machata <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/net/ynl/lib/ynl.py')
| -rw-r--r-- | tools/net/ynl/lib/ynl.py | 3 |
1 files changed, 2 insertions, 1 deletions
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 @@ class Netlink: 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): |
