Skip to content

Commit 8076738

Browse files
committed
Code improvement - remove duplicate test
1 parent 86d500a commit 8076738

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/Dancer2/Core/App.pm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,18 +1210,20 @@ sub compile_hooks {
12101210
eval { $EVAL_SHIM->($hook,@_); 1; }
12111211
or do {
12121212
my $err = $@ || "Zombie Error";
1213+
my $is_hook_exception = $position eq 'core.app.hook_exception';
12131214
# Don't execute the hook_exception hook if the exception
12141215
# has been generated from a hook exception handler itself,
12151216
# thus preventing potentially recursive code.
12161217
$app->execute_hook( 'core.app.hook_exception', $app, $err )
1217-
unless $position eq 'core.app.hook_exception';
1218+
unless $is_hook_exception;
12181219
my $is_halted = $app->response->is_halted; # Capture before cleanup
12191220
# We can't cleanup if we're in the hook for a hook
12201221
# exception, as this would clear the custom response that
12211222
# may have been set by the hook. However, there is no need
12221223
# to do so, as the upper hook that called this hook
12231224
# exception will perform the cleanup instead anyway
1224-
$app->cleanup unless $position eq 'core.app.hook_exception';
1225+
$app->cleanup
1226+
unless $is_hook_exception;
12251227
# Allow the hook function to halt the response, thus
12261228
# retaining any response it may have set. Otherwise the
12271229
# croak from this function will overwrite any content that

0 commit comments

Comments
 (0)