[dancer-users] Automatic JSON serializer breaks error page

Yanick Champoux yanick at babyl.dyndns.org
Fri Mar 14 01:16:24 GMT 2014


On 14-03-13 08:57 PM, Warren Young wrote:
> Is there a way I can fix this without going back to manual JSON encoding?

My first thought is: do something with the 'before_serializer' hook.

hook 'before_serializer' => sub {
	my $res = shift;

         # set the answer to a glorious nothing if an exception is caught
	$rest->content({}) if $res->content->{exception};
};

disclaimer: I didn't try it, so I might be wrong.

Joy,
`/anick


More information about the dancer-users mailing list