From a24184d684defca071742188910f4b80713d4b08 Mon Sep 17 00:00:00 2001 From: D Ruth Holloway Date: Fri, 21 Jul 2023 23:27:28 -0400 Subject: [PATCH 1/2] Show correct usage of Dancer2::Core::Error The documentation for Dancer2::Core::Error includes instantiating a new object, using the render() method (which doesn't exist anymore), and then setting the object as the response using Dancer2::Core::Response's set, which doesn't exist. Instead, we just create a new instance and call throw. Closes GH #1669 --- lib/Dancer2/Core/Error.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Dancer2/Core/Error.pm b/lib/Dancer2/Core/Error.pm index 840a44fdd..272fee089 100644 --- a/lib/Dancer2/Core/Error.pm +++ b/lib/Dancer2/Core/Error.pm @@ -475,7 +475,6 @@ __END__ =head1 SYNOPSIS - # taken from send_file: use Dancer2::Core::Error; my $error = Dancer2::Core::Error->new( @@ -483,7 +482,7 @@ __END__ message => "No such file: `$path'" ); - Dancer2::Core::Response->set($error->render); + $error->throw; =head1 DESCRIPTION From 7e3de03fe332e3bbc8c0cb8cb15897ebfb3df341 Mon Sep 17 00:00:00 2001 From: "Jason A. Crome" Date: Mon, 24 Jul 2023 21:27:26 -0400 Subject: [PATCH 2/2] reflect changes --- Changes | 1 + lib/Dancer2.pm | 1 + 2 files changed, 2 insertions(+) diff --git a/Changes b/Changes index 468824407..12de035fd 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,7 @@ [ ENHANCEMENTS ] [ DOCUMENTATION ] + * GH #1669: Show correct usage of Dancer2::Core::Error (GeekRuthie) * GH #1674: Fix POD for input_handle() (mauke) 0.400001 2023-02-05 18:41:48-05:00 America/New_York diff --git a/lib/Dancer2.pm b/lib/Dancer2.pm index 61b84fc46..241ad4edc 100644 --- a/lib/Dancer2.pm +++ b/lib/Dancer2.pm @@ -307,6 +307,7 @@ We are also on IRC: #dancer on irc.perl.org. Fayland Lam ferki Gabor Szabo + GeekRuthie geistteufel Gideon D'souza Gil Magno