mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
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 <petrm@nvidia.com> Link: https://lore.kernel.org/r/20240403023426.1762996-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
1d056bf9a4
commit
b269d2b4a5
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user