File Coverage

blib/lib/Sentry/Stacktrace.pm
Criterion Covered Total %
statement 15 19 78.9
branch 2 2 100.0
condition n/a
subroutine 3 4 75.0
pod 0 2 0.0
total 20 27 74.0


line stmt bran cond sub pod time code
1             package Sentry::Stacktrace;
2 5     5   390020 use Mojo::Base -base, -signatures;
  5         11  
  5         37  
3              
4 5     5   4341 use Sentry::Stacktrace::Frame;
  5         17  
  5         31  
5              
6             has exception => undef;
7              
8             has frame_filter => sub {
9             sub {0}
10             };
11              
12             has frames => sub ($self) { return $self->prepare_frames() };
13              
14 2     2 0 532124 sub prepare_frames ($self) {
  2         4  
  2         1  
15 2 100       7 if (!$self->exception->can('frames')) {
16 1         11 return [];
17             }
18              
19 1         14 my @frames = reverse map { Sentry::Stacktrace::Frame->from_caller($_->@*) }
  2         24  
20             $self->exception->frames->@*;
21              
22 1         9 return [grep { $self->frame_filter->($_) } @frames];
  2         8  
23             }
24              
25 0     0 0   sub TO_JSON ($self) {
  0            
  0            
26 0           return { frames => $self->frames };
27             }
28              
29             1;