From 5d224daeebf27ad3b893f6255f235d29f90f7a9f Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 10 Dec 2021 20:48:35 +0100 Subject: ConfigError: T4068: automatically wrap message at 72 characters (cherry picked from commit 4948380a588dea59a01e6e33b9b8e1524ba6a4ed) --- python/vyos/base.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/vyos/base.py b/python/vyos/base.py index 4e23714e5..c78045548 100644 --- a/python/vyos/base.py +++ b/python/vyos/base.py @@ -1,4 +1,4 @@ -# Copyright 2018 VyOS maintainers and contributors +# Copyright 2018-2021 VyOS maintainers and contributors # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -13,6 +13,11 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library. If not, see . +from textwrap import fill class ConfigError(Exception): - pass + def __init__(self, message): + # Reformat the message and trim it to 72 characters in length + message = fill(message, width=72) + # Call the base class constructor with the parameters it needs + super().__init__(message) -- cgit v1.2.3