Esempio n. 1
0
    def get_context(self, event, is_public=False, **kwargs):
        newest_first = is_newest_frame_first(event)
        context_kwargs = {
            'event': event,
            'is_public': is_public,
            'newest_first': newest_first,
        }

        exceptions = []
        last = len(self.values) - 1
        for num, e in enumerate(self.values):
            context = e.get_context(**context_kwargs)
            if e.stacktrace:
                context['stacktrace'] = e.stacktrace.get_context(
                    with_stacktrace=False, **context_kwargs)
            else:
                context['stacktrace'] = {}
            context['stack_id'] = 'exception_%d' % (num,)
            context['is_root'] = num == last
            exceptions.append(context)

        if newest_first:
            exceptions.reverse()

        return {
            'newest_first': newest_first,
            'system_frames': sum(e['stacktrace'].get('system_frames', 0) for e in exceptions),
            'exceptions': exceptions,
            'stacktrace': self.get_stacktrace(event, newest_first=newest_first)
        }
Esempio n. 2
0
    def get_context(self, event, is_public=False, **kwargs):
        newest_first = is_newest_frame_first(event)
        context_kwargs = {
            'event': event,
            'is_public': is_public,
            'newest_first': newest_first,
        }

        exceptions = []
        last = len(self.values) - 1
        for num, e in enumerate(self.values):
            context = e.get_context(**context_kwargs)
            if e.stacktrace:
                context['stacktrace'] = e.stacktrace.get_context(
                    with_stacktrace=False, **context_kwargs)
            else:
                context['stacktrace'] = {}
            context['stack_id'] = 'exception_%d' % (num, )
            context['is_root'] = num == last
            exceptions.append(context)

        if newest_first:
            exceptions.reverse()

        return {
            'newest_first':
            newest_first,
            'system_frames':
            sum(e['stacktrace'].get('system_frames', 0) for e in exceptions),
            'exceptions':
            exceptions,
            'stacktrace':
            self.get_stacktrace(event, newest_first=newest_first)
        }
Esempio n. 3
0
    def get_context(self, event, is_public=False, **kwargs):
        newest_first = is_newest_frame_first(event)

        system_frames = 0
        app_frames = 0
        for exc in self.values:
            if not exc.stacktrace:
                continue

            for frame in exc.stacktrace.frames:
                if frame.in_app:
                    app_frames += 1
                else:
                    system_frames += 1

                if (app_frames and system_frames):
                    break

        # if there is a mix of frame styles then we indicate that system frames
        # are present and should be represented as a split
        has_system_frames = app_frames and system_frames

        context_kwargs = {
            'event': event,
            'is_public': is_public,
            'newest_first': newest_first,
            'has_system_frames': has_system_frames,
        }

        exceptions = []
        last = len(self.values) - 1
        for num, e in enumerate(self.values):
            context = e.get_context(**context_kwargs)
            if e.stacktrace:
                context['stacktrace'] = e.stacktrace.get_context(
                    with_stacktrace=False, **context_kwargs)
            else:
                context['stacktrace'] = {}
            context['stack_id'] = 'exception_%d' % (num,)
            context['is_root'] = num == last
            exceptions.append(context)

        if newest_first:
            exceptions.reverse()

        if self.exc_omitted:
            first_exc_omitted, last_exc_omitted = self.exc_omitted
        else:
            first_exc_omitted, last_exc_omitted = None, None

        return {
            'newest_first': newest_first,
            'system_frames': system_frames if has_system_frames else 0,
            'exceptions': exceptions,
            'stacktrace': self.get_stacktrace(event, newest_first=newest_first),
            'first_exc_omitted': first_exc_omitted,
            'last_exc_omitted': last_exc_omitted,
        }
Esempio n. 4
0
    def get_context(self, event, is_public=False, **kwargs):
        newest_first = is_newest_frame_first(event)

        system_frames = 0
        app_frames = 0
        unknown_frames = 0
        for exc in self.values:
            if not exc.stacktrace:
                continue

            for frame in exc.stacktrace.frames:
                if frame.in_app is False:
                    system_frames += 1
                elif frame.in_app is True:
                    app_frames += 1
                else:
                    unknown_frames += 1

        # TODO(dcramer): this should happen in normalize
        # We need to ensure that implicit values for in_app are handled
        # appropriately
        if unknown_frames and (app_frames or system_frames):
            for exc in self.values:
                if not exc.stacktrace:
                    continue

                for frame in exc.stacktrace.frames:
                    if frame.in_app is None:
                        frame.in_app = bool(system_frames)
                        if frame.in_app:
                            app_frames += 1
                        else:
                            system_frames += 1

        # if there is a mix of frame styles then we indicate that system frames
        # are present and should be represented as a split
        has_system_frames = app_frames and system_frames

        context_kwargs = {
            'event': event,
            'is_public': is_public,
            'newest_first': newest_first,
            'has_system_frames': has_system_frames,
        }

        exceptions = []
        last = len(self.values) - 1
        for num, e in enumerate(self.values):
            context = e.get_context(**context_kwargs)
            if e.stacktrace:
                context['stacktrace'] = e.stacktrace.get_context(
                    with_stacktrace=False, **context_kwargs)
            else:
                context['stacktrace'] = {}
            context['stack_id'] = 'exception_%d' % (num,)
            context['is_root'] = num == last
            exceptions.append(context)

        if newest_first:
            exceptions.reverse()

        if self.exc_omitted:
            first_exc_omitted, last_exc_omitted = self.exc_omitted
        else:
            first_exc_omitted, last_exc_omitted = None, None

        return {
            'newest_first': newest_first,
            'system_frames': system_frames if has_system_frames else 0,
            'exceptions': exceptions,
            'stacktrace': self.get_stacktrace(event, newest_first=newest_first),
            'first_exc_omitted': first_exc_omitted,
            'last_exc_omitted': last_exc_omitted,
        }
Esempio n. 5
0
    def get_context(self, event, is_public=False, **kwargs):
        newest_first = is_newest_frame_first(event)

        system_frames = 0
        app_frames = 0
        unknown_frames = 0
        for exc in self.values:
            if not exc.stacktrace:
                continue

            for frame in exc.stacktrace.frames:
                if frame.in_app is False:
                    system_frames += 1
                elif frame.in_app is True:
                    app_frames += 1
                else:
                    unknown_frames += 1

        # TODO(dcramer): this should happen in normalize
        # We need to ensure that implicit values for in_app are handled
        # appropriately
        if unknown_frames and (app_frames or system_frames):
            for exc in self.values:
                if not exc.stacktrace:
                    continue

                for frame in exc.stacktrace.frames:
                    if frame.in_app is None:
                        frame.in_app = bool(system_frames)
                        if frame.in_app:
                            app_frames += 1
                        else:
                            system_frames += 1

        # if there is a mix of frame styles then we indicate that system frames
        # are present and should be represented as a split
        has_system_frames = app_frames and system_frames

        context_kwargs = {
            'event': event,
            'is_public': is_public,
            'newest_first': newest_first,
            'has_system_frames': has_system_frames,
        }

        exceptions = []
        last = len(self.values) - 1
        for num, e in enumerate(self.values):
            context = e.get_context(**context_kwargs)
            if e.stacktrace:
                context['stacktrace'] = e.stacktrace.get_context(
                    with_stacktrace=False, **context_kwargs)
            else:
                context['stacktrace'] = {}
            context['stack_id'] = 'exception_%d' % (num, )
            context['is_root'] = num == last
            exceptions.append(context)

        if newest_first:
            exceptions.reverse()

        if self.exc_omitted:
            first_exc_omitted, last_exc_omitted = self.exc_omitted
        else:
            first_exc_omitted, last_exc_omitted = None, None

        return {
            'newest_first': newest_first,
            'system_frames': system_frames if has_system_frames else 0,
            'exceptions': exceptions,
            'stacktrace': self.get_stacktrace(event,
                                              newest_first=newest_first),
            'first_exc_omitted': first_exc_omitted,
            'last_exc_omitted': last_exc_omitted,
        }