ErrorCatcher/Plugin/CleanUp/Pg/UniqueConstraintViolation.pm

filter: Statementstmt 100% 15 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 100% 19 / 19 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
tidy_message
1.0
CRAP 1.0
« ErrorCatcher/Plugin/CleanUp/Pg/TransactionAborted.pm ↑ Summary ErrorCatcher/Plugin/CleanUp/TxnDo.pm »
1 package Catalyst::Plugin::ErrorCatcher::Plugin::CleanUp::Pg::UniqueConstraintViolation;
2 2 $Catalyst::Plugin::ErrorCatcher::Plugin::CleanUp::Pg::UniqueConstraintViolation::VERSION = '0.0.8.18';
3 {
4 2 $Catalyst::Plugin::ErrorCatcher::Plugin::CleanUp::Pg::UniqueConstraintViolation::DIST = 'Catalyst-Plugin-ErrorCatcher';
5 }
6 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 6 ▶sub tidy_message {
Subroutine tidy_message: called CC=1 SCAR=0.0
Pod documented
10 6 my $plugin = shift;
11 6 my $errstr_ref = shift;
12  
13 # update or delete on table "foo" violates foreign key constraint
14 # "foobar_fkey" on table "baz"
15 6 ${$errstr_ref} =~ s{
16 \A
17 .+?
18 DBI \s Exception:
19 .+?
20 ERROR:\s+
21 duplicate \s+ key \s+ value \s+
22 violates \s unique \s constraint \s
23 "(.+?)" \s
24 .+?
25 Key \s+ \(
26 (.+?)
27 \)
28 \= \(
29 (.+?)
30 \)
31 \s+ already \s+ exists
32 .+
33 $
34 }{Unique constraint violation: $2 -> $3 [$1]}xmsg;
35  
36 6 $errstr_ref;
37 }
38  
39 2 1;
40 # ABSTRACT: cleanup foreign key violation messages from Pg
41  
42 __END__
« ErrorCatcher/Plugin/CleanUp/Pg/TransactionAborted.pm ↑ Summary ErrorCatcher/Plugin/CleanUp/TxnDo.pm »