MCPcopy Index your code
hub / github.com/MCSLTeam/MCSL2 / exceptionFilter

Function exceptionFilter

MCSL2Lib/utils.py:275–300  ·  view source on GitHub ↗

过滤异常

(
    ty: Type[BaseException], value: BaseException, _traceback: TracebackType
)

Source from the content-addressed store, hash-verified

273
274
275def exceptionFilter(
276 ty: Type[BaseException], value: BaseException, _traceback: TracebackType
277) -> ExceptionFilterMode:
278 """
279 过滤异常
280 """
281 if isinstance(value, AttributeError) and "MessageBox" in str(value):
282 return ExceptionFilterMode.SILENT
283 if isinstance(value, RuntimeError) and "wrapped C/C++ object of type" in str(value):
284 return ExceptionFilterMode.PASS
285 if isinstance(value, Exception) and "raise test" in str(value):
286 return ExceptionFilterMode.RAISE
287 if isinstance(value, Exception) and "pass test" in str(value):
288 return ExceptionFilterMode.PASS
289 if isinstance(value, Exception) and "print test" in str(value):
290 return ExceptionFilterMode.RAISE_AND_PRINT
291 if isinstance(
292 value, Exception
293 ) and "RunningServerHeaderCardWidget cannot be converted to PyQt5.QtWidgets.QLayoutItem" in str(
294 value
295 ):
296 return ExceptionFilterMode.SILENT
297 if isinstance(value, Exception) and "sipBadCatcherResult" in str(value):
298 return ExceptionFilterMode.SILENT
299
300 return ExceptionFilterMode.RAISE_AND_PRINT
301
302
303def checkSHA1(fileAndSha1: Iterable, _filter: Callable[[str, str], bool] = None) -> List[Dict]:

Callers 1

catchExceptionsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected