[Dancer-users] send_error requiring return
ambs
ambs+dancer at perl-hackers.net
Wed Dec 14 11:49:08 CET 2011
Hello
It is the correct behavior. You ned a return.
Quoting the documentation:
"This will not cause your route handler to return immediately, so be
careful that your route handler doesn't then override the error. You
can avoid that by saying "return send_error(...)" instead."
Cheers
ambs
On 13/12/2011 23:29, Lee Carmichael wrote:
> Hello,
>
> After reading the documentation on the 'send_error' function
> (https://metacpan.org/module/Dancer#send_error), I expected it to work
> without needing a return:
>
> i.e.
>
> get '/route1' => sub {
> send_error "route1 error";
> return "value from route1";
> };
>
> but I found that i need to use a return with it, like:
>
> get '/route2' => sub {
> return send_error "route2 error";
> return "value from route2";
> };
>
>
> Is this an error in documentation, my understanding of documentation
> or a bug with the software (if so I'll open a bug with test case). I'm
> using Dancer 1.3080 and I was able to replicate this in the dancer
> test suite with a new test case.
>
> Thanks,
>
> Lee
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
More information about the Dancer-users
mailing list