[Dancer-users] send_error requiring return

damien krotkine dkrotkine at gmail.com
Wed Dec 14 12:35:08 CET 2011


Hi,

Ambs : in the new versions, send_error immediatly exists the current
route, so there is no need to use 'return'.

Lee Carmichael : This new behaviour is available only in 1,3090, not
in 1.3080. So I guess you just need to upgrade :) Let me know if it's
still buggy.

Cheers,
dams

On 14 December 2011 11:49, ambs <ambs+dancer at perl-hackers.net> wrote:
> 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
>
>
> _______________________________________________
> 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