Ejemplo n.º 1
0
    def should_stop_on_exception(self, frame, event, arg):
        # ENDIF

        # main_debugger, _filename, info, _thread = self._args
        main_debugger = self._args[0]
        info = self._args[2]
        flag = False

        # STATE_SUSPEND = 2
        if info.pydev_state != 2:  #and breakpoint is not None:
            exception, value, trace = arg

            if trace is not None:  #on jython trace is None on the first event
                exception_breakpoint = get_exception_breakpoint(
                    exception, main_debugger.break_on_caught_exceptions)

                if exception_breakpoint is not None:
                    if exception_breakpoint.ignore_libraries:
                        if exception_breakpoint.notify_on_first_raise_only:
                            if main_debugger.first_appearance_in_scope(trace):
                                add_exception_to_frame(
                                    frame, (exception, value, trace))
                                try:
                                    info.pydev_message = exception_breakpoint.qname
                                except:
                                    info.pydev_message = exception_breakpoint.qname.encode(
                                        'utf-8')
                                flag = True
                            else:
                                pydev_log.debug(
                                    "Ignore exception %s in library %s" %
                                    (exception, frame.f_code.co_filename))
                                flag = False
                    else:
                        if not exception_breakpoint.notify_on_first_raise_only or just_raised(
                                trace):
                            add_exception_to_frame(frame,
                                                   (exception, value, trace))
                            try:
                                info.pydev_message = exception_breakpoint.qname
                            except:
                                info.pydev_message = exception_breakpoint.qname.encode(
                                    'utf-8')
                            flag = True
                        else:
                            flag = False
                else:
                    try:
                        if main_debugger.plugin is not None:
                            result = main_debugger.plugin.exception_break(
                                main_debugger, self, frame, self._args, arg)
                            if result:
                                flag, frame = result
                    except:
                        flag = False

        return flag, frame
Ejemplo n.º 2
0
def exception_break(plugin, main_debugger, pydb_frame, frame, args, arg):
    main_debugger = args[0]
    thread = args[3]
    exception, value, trace = arg

    if main_debugger.django_exception_break and exception is not None:
        if exception.__name__ in ['VariableDoesNotExist', 'TemplateDoesNotExist', 'TemplateSyntaxError'] and \
                just_raised(trace) and not ignore_exception_trace(trace):

            if exception.__name__ == 'TemplateSyntaxError':
                # In this case we don't actually have a regular render frame with the context
                # (we didn't really get to that point).
                token = getattr(value, 'token', None)
                lineno = getattr(token, 'lineno', None)
                filename = None
                if lineno is not None:
                    get_template_frame = frame
                    while get_template_frame.f_code.co_name != 'get_template':
                        get_template_frame = get_template_frame.f_back

                    origin = None
                    if get_template_frame is not None:
                        origin = get_template_frame.f_locals.get('origin')

                    if hasattr(origin, 'name') and origin.name is not None:
                        filename = normcase(_convert_to_str(origin.name))

                if filename is not None and lineno is not None:
                    syntax_error_frame = DjangoTemplateSyntaxErrorFrame(
                        frame, filename, lineno, {
                            'token': token,
                            'exception': exception
                        })

                    suspend_frame = suspend_django(main_debugger, thread,
                                                   syntax_error_frame,
                                                   CMD_ADD_EXCEPTION_BREAK)
                    return True, suspend_frame

            elif exception.__name__ == 'VariableDoesNotExist':
                if _is_django_variable_does_not_exist_exception_break_context(
                        frame):
                    render_frame = _find_django_render_frame(frame)
                    if render_frame:
                        suspend_frame = suspend_django(
                            main_debugger, thread,
                            DjangoTemplateFrame(render_frame),
                            CMD_ADD_EXCEPTION_BREAK)
                        if suspend_frame:
                            add_exception_to_frame(suspend_frame,
                                                   (exception, value, trace))
                            thread.additional_info.pydev_message = 'VariableDoesNotExist'
                            suspend_frame.f_back = frame
                            frame = suspend_frame
                            return True, frame

    return None
Ejemplo n.º 3
0
def exception_break(plugin, main_debugger, pydb_frame, frame, args, arg):
    main_debugger = args[0]
    thread = args[3]
    exception, value, trace = arg

    if main_debugger.django_exception_break and exception is not None:
        if exception.__name__ in ['VariableDoesNotExist', 'TemplateDoesNotExist', 'TemplateSyntaxError'] and \
                just_raised(trace) and not ignore_exception_trace(trace):

            if exception.__name__ == 'TemplateSyntaxError':
                # In this case we don't actually have a regular render frame with the context
                # (we didn't really get to that point).
                token = getattr(value, 'token', None)

                if token is None:
                    # Django 1.7 does not have token in exception. Try to get it from locals.
                    token = frame.f_locals.get('token')

                lineno = getattr(token, 'lineno', None)

                filename = None
                if lineno is not None:
                    filename = _get_filename_from_origin_in_parent_frame_locals(frame, 'get_template')

                    if filename is None:
                        # Django 1.7 does not have origin in get_template. Try to get it from
                        # load_template.
                        filename = _get_filename_from_origin_in_parent_frame_locals(frame, 'load_template')

                if filename is not None and lineno is not None:
                    syntax_error_frame = DjangoTemplateSyntaxErrorFrame(
                        frame, filename, lineno, {'token': token, 'exception': exception})

                    suspend_frame = suspend_django(
                        main_debugger, thread, syntax_error_frame, CMD_ADD_EXCEPTION_BREAK)
                    return True, suspend_frame

            elif exception.__name__ == 'VariableDoesNotExist':
                if _is_django_variable_does_not_exist_exception_break_context(frame):
                    if not getattr(exception, 'silent_variable_failure', False) and not _is_ignoring_failures(frame):
                        render_frame = _find_django_render_frame(frame)
                        if render_frame:
                            suspend_frame = suspend_django(
                                main_debugger, thread, DjangoTemplateFrame(render_frame), CMD_ADD_EXCEPTION_BREAK)
                            if suspend_frame:
                                add_exception_to_frame(suspend_frame, (exception, value, trace))
                                thread.additional_info.pydev_message = 'VariableDoesNotExist'
                                suspend_frame.f_back = frame
                                frame = suspend_frame
                                return True, frame

    return None
Ejemplo n.º 4
0
def exception_break(plugin, main_debugger, pydb_frame, frame, args, arg):
    main_debugger = args[0]
    thread = args[3]
    exception, value, trace = arg

    if main_debugger.django_exception_break and exception is not None:
        if exception.__name__ in ['VariableDoesNotExist', 'TemplateDoesNotExist', 'TemplateSyntaxError'] and \
                just_raised(trace) and not ignore_exception_trace(trace):

            if exception.__name__ == 'TemplateSyntaxError':
                # In this case we don't actually have a regular render frame with the context
                # (we didn't really get to that point).
                token = getattr(value, 'token', None)

                if token is None:
                    # Django 1.7 does not have token in exception. Try to get it from locals.
                    token = frame.f_locals.get('token')

                lineno = getattr(token, 'lineno', None)

                filename = None
                if lineno is not None:
                    filename = _get_filename_from_origin_in_parent_frame_locals(frame, 'get_template')

                    if filename is None:
                        # Django 1.7 does not have origin in get_template. Try to get it from
                        # load_template.
                        filename = _get_filename_from_origin_in_parent_frame_locals(frame, 'load_template')

                if filename is not None and lineno is not None:
                    syntax_error_frame = DjangoTemplateSyntaxErrorFrame(
                        frame, filename, lineno, {'token': token, 'exception': exception})

                    suspend_frame = suspend_django(
                        main_debugger, thread, syntax_error_frame, CMD_ADD_EXCEPTION_BREAK)
                    return True, suspend_frame

            elif exception.__name__ == 'VariableDoesNotExist':
                if _is_django_variable_does_not_exist_exception_break_context(frame):
                    if not getattr(exception, 'silent_variable_failure', False) and not _is_ignoring_failures(frame):
                        render_frame = _find_django_render_frame(frame)
                        if render_frame:
                            suspend_frame = suspend_django(
                                main_debugger, thread, DjangoTemplateFrame(render_frame), CMD_ADD_EXCEPTION_BREAK)
                            if suspend_frame:
                                add_exception_to_frame(suspend_frame, (exception, value, trace))
                                thread.additional_info.pydev_message = 'VariableDoesNotExist'
                                suspend_frame.f_back = frame
                                frame = suspend_frame
                                return True, frame

    return None
Ejemplo n.º 5
0
    def should_stop_on_exception(self, frame, event, arg):
        # ENDIF

        # main_debugger, _filename, info, _thread = self._args
        main_debugger = self._args[0]
        info = self._args[2]
        flag = False

        if info.pydev_state != STATE_SUSPEND:  # and breakpoint is not None:
            exception, value, trace = arg

            if trace is not None:  # on jython trace is None on the first event
                exception_breakpoint = get_exception_breakpoint(exception, main_debugger.break_on_caught_exceptions)

                if exception_breakpoint is not None:
                    if exception_breakpoint.ignore_libraries:
                        if exception_breakpoint.notify_on_first_raise_only:
                            if main_debugger.first_appearance_in_scope(trace):
                                add_exception_to_frame(frame, (exception, value, trace))
                                try:
                                    info.pydev_message = exception_breakpoint.qname
                                except:
                                    info.pydev_message = exception_breakpoint.qname.encode("utf-8")
                                flag = True
                            else:
                                pydev_log.debug(
                                    "Ignore exception %s in library %s" % (exception, frame.f_code.co_filename)
                                )
                                flag = False
                    else:
                        if not exception_breakpoint.notify_on_first_raise_only or just_raised(trace):
                            add_exception_to_frame(frame, (exception, value, trace))
                            try:
                                info.pydev_message = exception_breakpoint.qname
                            except:
                                info.pydev_message = exception_breakpoint.qname.encode("utf-8")
                            flag = True
                        else:
                            flag = False
                else:
                    try:
                        if main_debugger.plugin is not None:
                            result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
                            if result:
                                (flag, frame) = result
                    except:
                        flag = False

        return flag, frame
Ejemplo n.º 6
0
def exception_break(plugin, main_debugger, pydb_frame, frame, args, arg):
    main_debugger, filename, info, thread = args
    exception, value, trace = arg
    if main_debugger.django_exception_break and \
            get_exception_name(exception) in ['VariableDoesNotExist', 'TemplateDoesNotExist', 'TemplateSyntaxError'] and \
            just_raised(trace) and _is_django_exception_break_context(frame):
        render_frame = _find_django_render_frame(frame)
        if render_frame:
            suspend_frame = suspend_django(main_debugger, thread, render_frame, CMD_ADD_EXCEPTION_BREAK)
            if suspend_frame:
                add_exception_to_frame(suspend_frame, (exception, value, trace))
                flag = True
                thread.additional_info.pydev_message = 'VariableDoesNotExist'
                suspend_frame.f_back = frame
                frame = suspend_frame
                return (flag, frame)
    return None
Ejemplo n.º 7
0
def exception_break(plugin, main_debugger, pydb_frame, frame, args, arg):
    main_debugger, filename, info, thread = args
    exception, value, trace = arg
    if main_debugger.django_exception_break and \
            get_exception_name(exception) in ['VariableDoesNotExist', 'TemplateDoesNotExist', 'TemplateSyntaxError'] and \
            just_raised(trace) and _is_django_exception_break_context(frame):
        render_frame = _find_django_render_frame(frame)
        if render_frame:
            suspend_frame = suspend_django(main_debugger, thread, render_frame, CMD_ADD_EXCEPTION_BREAK)
            if suspend_frame:
                add_exception_to_frame(suspend_frame, (exception, value, trace))
                flag = True
                thread.additional_info.pydev_message = 'VariableDoesNotExist'
                suspend_frame.f_back = frame
                frame = suspend_frame
                return (flag, frame)
    return None
Ejemplo n.º 8
0
    def should_stop_on_exception(self, frame, event, arg):
    # ENDIF

        # main_debugger, _filename, info, _thread = self._args
        main_debugger = self._args[0]
        info = self._args[2]
        should_stop = False

        # STATE_SUSPEND = 2
        if info.pydev_state != 2:  # and breakpoint is not None:
            exception, value, trace = arg

            if trace is not None and hasattr(trace, 'tb_next'):
                # on jython trace is None on the first event and it may not have a tb_next.

                exception_breakpoint = main_debugger.get_exception_breakpoint(
                    exception, main_debugger.break_on_caught_exceptions)

                if exception_breakpoint is not None:
                    if exception_breakpoint.condition is not None:
                        eval_result = main_debugger.handle_breakpoint_condition(info, exception_breakpoint, frame)
                        if not eval_result:
                            return False, frame

                    if exception_breakpoint.ignore_libraries:
                        if not main_debugger.is_exception_trace_in_project_scope(trace):
                            pydev_log.debug("Ignore exception %s in library %s -- (%s)" % (exception, frame.f_code.co_filename, frame.f_code.co_name))
                            return False, frame

                    if ignore_exception_trace(trace):
                        return False, frame

                    was_just_raised = just_raised(trace)
                    if was_just_raised:

                        if main_debugger.skip_on_exceptions_thrown_in_same_context:
                            # Option: Don't break if an exception is caught in the same function from which it is thrown
                            return False, frame

                    if exception_breakpoint.notify_on_first_raise_only:
                        if main_debugger.skip_on_exceptions_thrown_in_same_context:
                            # In this case we never stop if it was just raised, so, to know if it was the first we
                            # need to check if we're in the 2nd method.
                            if not was_just_raised and not just_raised(trace.tb_next):
                                return False, frame  # I.e.: we stop only when we're at the caller of a method that throws an exception

                        else:
                            if not was_just_raised:
                                return False, frame  # I.e.: we stop only when it was just raised

                    # If it got here we should stop.
                    should_stop = True
                    try:
                        info.pydev_message = exception_breakpoint.qname
                    except:
                        info.pydev_message = exception_breakpoint.qname.encode('utf-8')

                    # Always add exception to frame (must remove later after we proceed).
                    add_exception_to_frame(frame, (exception, value, trace))

                else:
                    # No regular exception breakpoint, let's see if some plugin handles it.
                    try:
                        if main_debugger.plugin is not None:
                            result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
                            if result:
                                should_stop, frame = result
                    except:
                        should_stop = False

                if should_stop:
                    if exception_breakpoint is not None and exception_breakpoint.expression is not None:
                        main_debugger.handle_breakpoint_expression(exception_breakpoint, info, frame)

        return should_stop, frame
Ejemplo n.º 9
0
    def should_stop_on_exception(self, frame, event, arg):
        # ENDIF

        # main_debugger, _filename, info, _thread = self._args
        main_debugger = self._args[0]
        info = self._args[2]
        should_stop = False

        # STATE_SUSPEND = 2
        if info.pydev_state != 2:  # and breakpoint is not None:
            exception, value, trace = arg

            if trace is not None and hasattr(trace, 'tb_next'):
                # on jython trace is None on the first event and it may not have a tb_next.

                should_stop = False
                exception_breakpoint = None
                try:
                    if main_debugger.plugin is not None:
                        result = main_debugger.plugin.exception_break(
                            main_debugger, self, frame, self._args, arg)
                        if result:
                            should_stop, frame = result
                except:
                    pydev_log.exception()

                if not should_stop:
                    # It was not handled by any plugin, lets check exception breakpoints.
                    exception_breakpoint = main_debugger.get_exception_breakpoint(
                        exception, main_debugger.break_on_caught_exceptions)

                    if exception_breakpoint is not None:
                        if exception is SystemExit and main_debugger.ignore_system_exit_code(
                                value):
                            return False, frame

                        if exception in (GeneratorExit, StopIteration):
                            # These exceptions are control-flow related (they work as a generator
                            # pause), so, we shouldn't stop on them.
                            return False, frame

                        if exception_breakpoint.condition is not None:
                            eval_result = main_debugger.handle_breakpoint_condition(
                                info, exception_breakpoint, frame)
                            if not eval_result:
                                return False, frame

                        if main_debugger.exclude_exception_by_filter(
                                exception_breakpoint, trace, False):
                            pydev_log.debug(
                                "Ignore exception %s in library %s -- (%s)" %
                                (exception, frame.f_code.co_filename,
                                 frame.f_code.co_name))
                            return False, frame

                        if ignore_exception_trace(trace):
                            return False, frame

                        was_just_raised = just_raised(trace)
                        if was_just_raised:

                            if main_debugger.skip_on_exceptions_thrown_in_same_context:
                                # Option: Don't break if an exception is caught in the same function from which it is thrown
                                return False, frame

                        if exception_breakpoint.notify_on_first_raise_only:
                            if main_debugger.skip_on_exceptions_thrown_in_same_context:
                                # In this case we never stop if it was just raised, so, to know if it was the first we
                                # need to check if we're in the 2nd method.
                                if not was_just_raised and not just_raised(
                                        trace.tb_next):
                                    return False, frame  # I.e.: we stop only when we're at the caller of a method that throws an exception

                            else:
                                if not was_just_raised:
                                    return False, frame  # I.e.: we stop only when it was just raised

                        # If it got here we should stop.
                        should_stop = True
                        try:
                            info.pydev_message = exception_breakpoint.qname
                        except:
                            info.pydev_message = exception_breakpoint.qname.encode(
                                'utf-8')

                if should_stop:
                    # Always add exception to frame (must remove later after we proceed).
                    add_exception_to_frame(frame, (exception, value, trace))

                    if exception_breakpoint is not None and exception_breakpoint.expression is not None:
                        main_debugger.handle_breakpoint_expression(
                            exception_breakpoint, info, frame)

        return should_stop, frame
Ejemplo n.º 10
0
    def should_stop_on_exception(self, frame, event, arg):
    # ENDIF

        # main_debugger, _filename, info, _thread = self._args
        main_debugger = self._args[0]
        info = self._args[2]
        should_stop = False

        # STATE_SUSPEND = 2
        if info.pydev_state != 2:  # and breakpoint is not None:
            exception, value, trace = arg

            if trace is not None and hasattr(trace, 'tb_next'):
                # on jython trace is None on the first event and it may not have a tb_next.

                exception_breakpoint = get_exception_breakpoint(
                    exception, main_debugger.break_on_caught_exceptions)

                if exception_breakpoint is not None:
                    if exception_breakpoint.condition is not None:
                        eval_result = handle_breakpoint_condition(main_debugger, info, exception_breakpoint, frame)
                        if not eval_result:
                            return False, frame

                    if exception_breakpoint.ignore_libraries:
                        if not main_debugger.is_exception_trace_in_project_scope(trace):
                            pydev_log.debug("Ignore exception %s in library %s -- (%s)" % (exception, frame.f_code.co_filename, frame.f_code.co_name))
                            return False, frame

                    if ignore_exception_trace(trace):
                        return False, frame

                    was_just_raised = just_raised(trace)
                    if was_just_raised:

                        if main_debugger.skip_on_exceptions_thrown_in_same_context:
                            # Option: Don't break if an exception is caught in the same function from which it is thrown
                            return False, frame

                    if exception_breakpoint.notify_on_first_raise_only:
                        if main_debugger.skip_on_exceptions_thrown_in_same_context:
                            # In this case we never stop if it was just raised, so, to know if it was the first we
                            # need to check if we're in the 2nd method.
                            if not was_just_raised and not just_raised(trace.tb_next):
                                return False, frame  # I.e.: we stop only when we're at the caller of a method that throws an exception

                        else:
                            if not was_just_raised:
                                return False, frame  # I.e.: we stop only when it was just raised

                    # If it got here we should stop.
                    should_stop = True
                    try:
                        info.pydev_message = exception_breakpoint.qname
                    except:
                        info.pydev_message = exception_breakpoint.qname.encode('utf-8')

                    # Always add exception to frame (must remove later after we proceed).
                    add_exception_to_frame(frame, (exception, value, trace))

                else:
                    # No regular exception breakpoint, let's see if some plugin handles it.
                    try:
                        if main_debugger.plugin is not None:
                            result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
                            if result:
                                should_stop, frame = result
                    except:
                        should_stop = False

                if should_stop:
                    if exception_breakpoint is not None and exception_breakpoint.expression is not None:
                        handle_breakpoint_expression(exception_breakpoint, info, frame)

        return should_stop, frame
Ejemplo n.º 11
0
    def should_stop_on_exception(self, frame, event, arg):
    # ENDIF

        # main_debugger, _filename, info, _thread = self._args
        main_debugger = self._args[0]
        info = self._args[2]
        flag = False

        # STATE_SUSPEND = 2
        if info.pydev_state != 2:  #and breakpoint is not None:
            exception, value, trace = arg

            if trace is not None: #on jython trace is None on the first event
                exception_breakpoint = get_exception_breakpoint(
                    exception, main_debugger.break_on_caught_exceptions)
                is_real = is_real_file(frame.f_code.co_filename)

                if exception_breakpoint is not None:
                    add_exception_to_frame(frame, (exception, value, trace))
                    if exception_breakpoint.condition is not None:
                        eval_result = handle_breakpoint_condition(main_debugger, info, exception_breakpoint, frame)
                        if not eval_result:
                            return False, frame

                    if exception_breakpoint.ignore_libraries:
                        if exception_breakpoint.notify_on_first_raise_only:
                            if main_debugger.first_appearance_in_scope(trace):
                                add_exception_to_frame(frame, (exception, value, trace))
                                try:
                                    info.pydev_message = exception_breakpoint.qname
                                except:
                                    info.pydev_message = exception_breakpoint.qname.encode('utf-8')
                                flag = True
                            else:
                                pydev_log.debug("Ignore exception %s in library %s" % (exception, frame.f_code.co_filename))
                                flag = False
                    else:
                        if not exception_breakpoint.notify_on_first_raise_only or just_raised(trace):
                            add_exception_to_frame(frame, (exception, value, trace))
                            try:
                                info.pydev_message = exception_breakpoint.qname
                            except:
                                info.pydev_message = exception_breakpoint.qname.encode('utf-8')
                            flag = True
                        else:
                            flag = False

                    if flag:
                        info.pydev_message = "python-%s" % info.pydev_message

                if exception_breakpoint is None or (not flag and not is_real):
                    try:
                        if main_debugger.plugin is not None:
                            result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
                            if result:
                                flag, frame = result
                    except:
                        flag = False

                if flag:
                    if exception_breakpoint is not None and exception_breakpoint.expression is not None:
                        handle_breakpoint_expression(exception_breakpoint, info, frame)
                else:
                    remove_exception_from_frame(frame)

        return flag, frame
Ejemplo n.º 12
0
    def should_stop_on_exception(self, frame, event, arg):
        # ENDIF

        # main_debugger, _filename, info, _thread = self._args
        main_debugger = self._args[0]
        info = self._args[2]
        should_stop = False

        # STATE_SUSPEND = 2
        if info.pydev_state != 2:  # and breakpoint is not None:
            exception, value, trace = arg

            if trace is not None and hasattr(trace, 'tb_next'):
                # on jython trace is None on the first event and it may not have a tb_next.

                should_stop = False
                exception_breakpoint = None
                try:
                    if main_debugger.plugin is not None:
                        result = main_debugger.plugin.exception_break(
                            main_debugger, self, frame, self._args, arg)
                        if result:
                            should_stop, frame = result
                except:
                    pydev_log.exception()

                if not should_stop:
                    was_just_raised = trace.tb_next is None

                    # It was not handled by any plugin, lets check exception breakpoints.
                    check_excs = []
                    exc_break_caught = main_debugger.get_exception_breakpoint(
                        exception, main_debugger.break_on_caught_exceptions)
                    if exc_break_caught is not None:
                        check_excs.append((exc_break_caught, False))

                    exc_break_user = main_debugger.get_exception_breakpoint(
                        exception,
                        main_debugger.break_on_user_uncaught_exceptions)
                    if exc_break_user is not None:
                        check_excs.append((exc_break_user, True))

                    for exc_break, is_user_uncaught in check_excs:
                        # Initially mark that it should stop and then go into exclusions.
                        should_stop = True

                        if exception is SystemExit and main_debugger.ignore_system_exit_code(
                                value):
                            should_stop = False

                        elif exception in (GeneratorExit, StopIteration):
                            # These exceptions are control-flow related (they work as a generator
                            # pause), so, we shouldn't stop on them.
                            should_stop = False

                        elif main_debugger.exclude_exception_by_filter(
                                exc_break, trace):
                            pydev_log.debug(
                                "Ignore exception %s in library %s -- (%s)" %
                                (exception, frame.f_code.co_filename,
                                 frame.f_code.co_name))
                            should_stop = False

                        elif ignore_exception_trace(trace):
                            should_stop = False

                        elif exc_break.condition is not None and \
                                not main_debugger.handle_breakpoint_condition(info, exc_break, frame):
                            should_stop = False

                        elif was_just_raised and main_debugger.skip_on_exceptions_thrown_in_same_context:
                            # Option: Don't break if an exception is caught in the same function from which it is thrown
                            should_stop = False

                        elif exc_break.notify_on_first_raise_only and main_debugger.skip_on_exceptions_thrown_in_same_context \
                                and not was_just_raised and not just_raised(trace.tb_next):
                            # In this case we never stop if it was just raised, so, to know if it was the first we
                            # need to check if we're in the 2nd method.
                            should_stop = False  # I.e.: we stop only when we're at the caller of a method that throws an exception

                        elif exc_break.notify_on_first_raise_only and not main_debugger.skip_on_exceptions_thrown_in_same_context \
                                and not was_just_raised:
                            should_stop = False  # I.e.: we stop only when it was just raised

                        elif is_user_uncaught and not (
                                not main_debugger.apply_files_filter(
                                    frame, frame.f_code.co_filename, True) and
                            (frame.f_back is None
                             or main_debugger.apply_files_filter(
                                 frame.f_back, frame.f_back.f_code.co_filename,
                                 True))):
                            # User uncaught means that we're currently in user code but the code
                            # up the stack is library code.
                            should_stop = False

                        if should_stop:
                            exception_breakpoint = exc_break
                            try:
                                info.pydev_message = exc_break.qname
                            except:
                                info.pydev_message = exc_break.qname.encode(
                                    'utf-8')
                            break

                if should_stop:
                    # Always add exception to frame (must remove later after we proceed).
                    add_exception_to_frame(frame, (exception, value, trace))

                    if exception_breakpoint is not None and exception_breakpoint.expression is not None:
                        main_debugger.handle_breakpoint_expression(
                            exception_breakpoint, info, frame)

        return should_stop, frame