过滤异常
(
ty: Type[BaseException], value: BaseException, _traceback: TracebackType
)
| 273 | |
| 274 | |
| 275 | def 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 | |
| 303 | def checkSHA1(fileAndSha1: Iterable, _filter: Callable[[str, str], bool] = None) -> List[Dict]: |