Skip to content

Commit 0629934

Browse files
committed
Update implementation
1 parent f1e71f9 commit 0629934

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pyomo/common/errors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ class PyomoException(Exception):
123123
Exception class for other Pyomo exceptions to inherit from,
124124
allowing Pyomo exceptions to be caught in a general way
125125
(e.g., in other applications that use Pyomo).
126-
Subclasses should define a class-level `default_message` attribute.
126+
Subclasses can define a class-level `default_message` attribute.
127127
"""
128128

129-
default_message = None
130-
131-
def __init__(self, message=None):
132-
super().__init__(message or self.default_message)
129+
def __init__(self, *args):
130+
if not args and getattr(self, 'default_message', None):
131+
args = (self.default_message,)
132+
return super().__init__(*args)
133133

134134

135135
class DeferredImportError(ImportError):

0 commit comments

Comments
 (0)