(pydb, frame, thread, arg, is_unwind)
| 495 | |
| 496 | |
| 497 | def exception_break(pydb, frame, thread, arg, is_unwind): |
| 498 | exception, value, trace = arg |
| 499 | if pydb.jinja2_exception_break and exception is not None: |
| 500 | exception_type = list(pydb.jinja2_exception_break.keys())[0] |
| 501 | if exception.__name__ in ("UndefinedError", "TemplateNotFound", "TemplatesNotFound"): |
| 502 | # errors in rendering |
| 503 | render_frame = _find_jinja2_render_frame(frame) |
| 504 | if render_frame: |
| 505 | suspend_frame = _suspend_jinja2(pydb, thread, render_frame, CMD_ADD_EXCEPTION_BREAK, message=exception_type) |
| 506 | if suspend_frame: |
| 507 | add_exception_to_frame(suspend_frame, (exception, value, trace)) |
| 508 | suspend_frame.f_back = frame |
| 509 | frame = suspend_frame |
| 510 | return True, frame |
| 511 | |
| 512 | elif exception.__name__ in ("TemplateSyntaxError", "TemplateAssertionError"): |
| 513 | name = frame.f_code.co_name |
| 514 | |
| 515 | # errors in compile time |
| 516 | if name in ("template", "top-level template code", "<module>") or name.startswith("block "): |
| 517 | f_back = frame.f_back |
| 518 | if f_back is not None: |
| 519 | module_name = f_back.f_globals.get("__name__", "") |
| 520 | |
| 521 | if module_name.startswith("jinja2."): |
| 522 | # Jinja2 translates exception info and creates fake frame on his own |
| 523 | pydb.set_suspend(thread, CMD_ADD_EXCEPTION_BREAK) |
| 524 | add_exception_to_frame(frame, (exception, value, trace)) |
| 525 | thread.additional_info.suspend_type = JINJA2_SUSPEND |
| 526 | thread.additional_info.pydev_message = str(exception_type) |
| 527 | return True, frame |
| 528 | return None |
nothing calls this directly
no test coverage detected