File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 11import functools
2+ import sys
3+ import types
24from dataclasses import dataclass
35from dataclasses import field
46from enum import Enum
@@ -118,6 +120,18 @@ def __str__(self) -> str:
118120 return self .message
119121
120122
123+ def raise_on_caller (exc : Exception ) -> None :
124+ """Raise exception appearing from caller's frame."""
125+ frame = sys ._getframe (2 )
126+ tb = types .TracebackType (
127+ tb_next = None ,
128+ tb_frame = frame ,
129+ tb_lasti = frame .f_lasti ,
130+ tb_lineno = frame .f_lineno ,
131+ )
132+ raise exc .with_traceback (tb )
133+
134+
121135@dataclass
122136class CheckResult :
123137 """Store a check result."""
@@ -186,7 +200,8 @@ def check_result(
186200 :raises SCIMTesterError: If raise_exceptions is True and status is ERROR or CRITICAL
187201 """
188202 if context .conf .raise_exceptions and status in (Status .ERROR , Status .CRITICAL ):
189- raise SCIMTesterError (reason or "Check failed" , context .conf )
203+ exc = SCIMTesterError (reason or "Check failed" , context .conf )
204+ raise_on_caller (exc )
190205
191206 return CheckResult (
192207 status = status ,
You can’t perform that action at this time.
0 commit comments