Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
try a bit harder to surface unexpected exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
karenetheridge committed Jan 7, 2021
1 parent 4893130 commit f0d52d8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/Test/Conch.pm
Expand Up @@ -611,12 +611,11 @@ subtest and is invoked with the test object as well as any additional provided a
=cut

sub txn_local ($self, $test_name, $subref, @args) {
$self->app->schema->txn_begin;

$self->app->txn_wrapper(sub {
local $Test::Builder::Level = $Test::Builder::Level + 1;
Test::More::subtest($test_name => $subref, $self, @args);

$self->app->schema->txn_rollback;
die 'rollback';
});
}

=head2 email_cmp_deeply
Expand Down Expand Up @@ -807,6 +806,7 @@ sub reset_log ($self) {
sub _request_ok ($self, @args) {
undef $self->{_mail_composed};
$self->reset_log;
$self->stash(undef);
my $result = $self->next::method(@args);

my $dump_log;
Expand All @@ -821,6 +821,9 @@ sub _request_ok ($self, @args) {
Data::Dumper->new([ $log_history ])->Sortkeys(1)->Indent(1)->Terse(1)->Dump
if $dump_log || $self->tx->res->code == 500 && $self->tx->req->url->path !~ qr{^/_die};

my $stash = $self->stash;
$self->test('note', 'request died: '.$stash->{exception}->message) if exists $stash->{exception};

return $result;
}

Expand Down

0 comments on commit f0d52d8

Please sign in to comment.