Skip to content

Commit fe49a2a

Browse files
committed
Improve error reporting
1 parent 2d7e94e commit fe49a2a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pyomo/common/tee.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,11 @@ def _exit_context_stack(self, et, ev, tb):
277277
FAIL = []
278278
while self.context_stack:
279279
try:
280-
self.context_stack.pop().__exit__(et, ev, tb)
280+
cm = self.context_stack.pop()
281+
cm.__exit__(et, ev, tb)
281282
except:
282-
FAIL.append(str(sys.exc_info()[1]))
283+
_stack = self.context_stack
284+
FAIL.append(f"{sys.exc_info()[1]} ({len(_stack)+1}: {cm}@{id(cm):x})")
283285
return FAIL
284286

285287
def __enter__(self):

0 commit comments

Comments
 (0)