amoore: Andrew Moore <amoore@cpan.org>
Andrew Mehta <Andrew@unitedgames.co.uk>
andrewalker: Andre Walker <andre@andrewalker.net>
+andybev: Andrew Beverley <a.beverley@ctrlo.com>
andyg: Andy Grundman <andy@hybridized.org>
ank: Andres Kievsky <ank@ank.com.ar>
arc: Aaron Crane <arc@cpan.org>
# FIXME FRAGILE - any eval that fails but *does not* rethrow between here
# and the unwind will trample over $@ and invalidate the entire mechanism
# There got to be a saner way of doing this...
- if (is_exception $@) {
+ #
+ # Deliberately *NOT* using is_exception - if someone left a misbehaving
+ # antipattern value in $@, it's not our business to whine about it
+ if( defined $@ and length $@ ) {
weaken(
$guard->{existing_exception_ref} = (length ref $@) ? $@ : \$@
);
sub is_exception ($) {
my $e = $_[0];
+ # FIXME
# this is not strictly correct - an eval setting $@ to undef
# is *not* the same as an eval setting $@ to ''
# but for the sake of simplicity assume the following for
. 'does) result in silent discarding of errors. DBIx::Class tries to '
. 'work around this as much as possible, but other parts of your '
. 'software stack may not be even aware of the problem. Please submit '
- . 'a bugreport against the distribution containing %s.',
+ . 'a bugreport against the distribution containing %s',
($class) x 2,
));
isa_ok $@, $ap;
} qr/\QObjects of external exception class '$ap' stringify to '' (the empty string)/,
'Proper warning on encountered antipattern';
+
+ warnings_are {
+ $@ = $ap->new;
+ $schema->txn_do (sub { 1 });
+
+ $@ = $ap->new;
+ $schema->txn_scope_guard->commit;
+ } [], 'No spurious PSA warnings on pre-existing antipatterns in $@';
+
}
done_testing;
lives_ok {
# this is what poisons $@
Text::Balanced::extract_bracketed( '(foo', '()' );
+ DBIx::Class::_Util::is_exception($@);
my $s = DBICTest::Schema->connect('dbi:SQLite::memory:');
my $g = $s->txn_scope_guard;