File Coverage

lib/Catalyst/Plugin/ErrorCatcher/Plugin/CleanUp/Pg/TransactionAborted.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 15 15 100.0


line stmt bran cond sub pod time code
1             package Catalyst::Plugin::ErrorCatcher::Plugin::CleanUp::Pg::TransactionAborted;
2             $Catalyst::Plugin::ErrorCatcher::Plugin::CleanUp::Pg::TransactionAborted::VERSION = '0.0.8.18';
3             {
4             $Catalyst::Plugin::ErrorCatcher::Plugin::CleanUp::Pg::TransactionAborted::DIST = 'Catalyst-Plugin-ErrorCatcher';
5             }
6 9     9   8637 use strict;
  9         20  
  9         387  
7 9     9   58 use warnings;
  9         18  
  9         1247  
8              
9             sub tidy_message {
10 28     28 1 61 my $plugin = shift;
11 28         166 my $errstr_ref = shift;
12              
13             # ERROR: current transaction is aborted, commands ignored until end of
14             # transaction block [for Statement
15 28         39 ${$errstr_ref} =~ s{
  28         78  
16             \A
17             .+?
18             DBI \s Exception:
19             .+?
20             ERROR:\s+
21             (
22             current \s transaction \s is \s aborted, \s
23             commands \s ignored \s until \s end \s of \s transaction \s block
24             )
25             \s \[ for \s Statement
26             \s+
27             .+
28             $
29             }{$1}xmsg;
30              
31 28         87 $errstr_ref;
32             }
33              
34             1;
35             # ABSTRACT: cleanup transaction aborted messages from Pg
36              
37             __END__
38              
39             =pod
40              
41             =encoding UTF-8
42              
43             =head1 NAME
44              
45             Catalyst::Plugin::ErrorCatcher::Plugin::CleanUp::Pg::TransactionAborted - cleanup transaction aborted messages from Pg
46              
47             =head1 VERSION
48              
49             version 0.0.8.18
50              
51             =head2 tidy_message($self, $stringref)
52              
53             Tidy up Postgres messages where the error is related to an I<aborted transaction>.
54              
55             =head1 AUTHOR
56              
57             Chisel <chisel@chizography.net>
58              
59             =head1 COPYRIGHT AND LICENSE
60              
61             This software is copyright (c) 2015 by Chisel Wright.
62              
63             This is free software; you can redistribute it and/or modify it under
64             the same terms as the Perl 5 programming language system itself.
65              
66             =cut