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
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
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) is_real = is_real_file(frame.f_code.co_filename) if exception_breakpoint is not None: if exception_breakpoint.condition is not None: # Always add exception to frame (must remove later after we proceed). add_exception_to_frame(frame, (exception, value, trace)) eval_result = handle_breakpoint_condition( main_debugger, info, exception_breakpoint, frame) remove_exception_from_frame(frame) if not eval_result: return False, frame if exception_breakpoint.ignore_libraries: if not main_debugger.is_exception_trace_in_project_scope( trace): 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 and not main_debugger.is_top_level_trace_in_project_scope( trace): 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)) info.pydev_message = "python-%s" % info.pydev_message 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
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
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