*{Symbol::qualify_to_ref(
'throw'
,
'Catalyst'
)} =
sub
{
return
&Catalyst::Plugin::Activator::Exception::throw
(
@_
);
};
sub
throw {
my
(
$c
,
$e
) =
@_
;
if
( !
defined
$e
) {
$e
= new Activator::Exception(
'unknown'
);
}
if
(
$e
eq
''
) {
$e
= new Activator::Exception(
'unknown'
);
}
if
( !
$c
->stash->{e}) {
$c
->stash->{e} = ();
}
if
( UNIVERSAL::isa(
$e
,
'Exception::Class'
) ) {
push
@{
$c
->stash->{e} },
$e
;
}
else
{
push
@{
$c
->stash->{e} }, Activator::Exception->new(
$e
);
}
return
;
}
sub
finalize {
my
(
$c
) =
@_
;
if
(
$c
->stash->{e} ) {
WARN(
"Execution had error(s)"
);
foreach
my
$e
( @{
$c
->stash->{e} } ) {
WARN(
$e
);
}
}
delete
$c
->stash->{e};
return
$c
->NEXT::finalize(
@_
);
}