| 1 | package DBIO::Exception; | ||||||||||
| 2 | # ABSTRACT: Exception objects for DBIO | ||||||||||
| 3 | |||||||||||
| 4 | 460 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 460 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 460 | our $VERSION = '0.900007'; | |||||||||
| 8 | |||||||||||
| 9 | # load Carp early to prevent tickling of the ::Internal stash being | ||||||||||
| 10 | # interpreted as "Carp is already loaded" by some braindead loader | ||||||||||
| 11 | 460 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 460 | $Carp::Internal{ (__PACKAGE__) }++; | |||||||||
| 13 | |||||||||||
| 14 | 460 | ▶ | use DBIO::Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 460 | ▶ | use DBIO::Util (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | use overload | ||||||||||
| 18 | 4534 | ▶ | '""' => sub { shift->{msg} }, | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 460 | fallback => 1; | |||||||||
| 20 | |||||||||||
| 21 | |||||||||||
| 22 | 3280 | ▶ | sub throw { | ||||||||
|
Subroutine
throw: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 23 | 3280 | my ($class, $msg, $stacktrace, $connect_info) = @_; | |||||||||
| 24 | |||||||||||
| 25 | # Don't re-encapsulate exception objects of any kind | ||||||||||
| 26 | 3280 | ▶ | die $msg if ref($msg); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | |||||||||||
| 28 | # all exceptions include a caller | ||||||||||
| 29 | 3100 | $msg =~ s/\n$//; | |||||||||
| 30 | |||||||||||
| 31 | 3100 | ▶ | if(!$stacktrace) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | # skip all frames that match the original caller, or any of | ||||||||||
| 33 | # the dbic-wide classdata patterns | ||||||||||
| 34 | 3014 | my ($ln, $calling) = DBIO::Carp::__find_caller( | |||||||||
| 35 | '^' . caller() . '$', | ||||||||||
| 36 | 'DBIO::Base', | ||||||||||
| 37 | ); | ||||||||||
| 38 | |||||||||||
| 39 | 3014 | $msg = "${calling}${msg} ${ln}\n"; | |||||||||
| 40 | } | ||||||||||
| 41 | else { | ||||||||||
| 42 | # the frames are shown with their arguments: no password among them | ||||||||||
| 43 | 86 | local $DBIO::Util::TRACE_CONNECT_INFO = $connect_info; | |||||||||
| 44 | 86 | $msg = DBIO::Util::masked_longmess($msg); | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 3100 | my $self = { msg => $msg }; | |||||||||
| 48 | 3100 | bless $self => $class; | |||||||||
| 49 | |||||||||||
| 50 | 3100 | die $self; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | 1 | ▶ | sub rethrow { | ||||||||
|
Subroutine
rethrow: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 55 | 1 | die shift; | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | 460 | 1; | |||||||||
| 59 | |||||||||||
| 60 | __END__ | ||||||||||