Skip to content

Commit e1e643d

Browse files
committed
include error in favorite add command
1 parent b230542 commit e1e643d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/MetaCPAN/Web/Controller/Account/Favorite.pm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,14 @@ sub add : Local : Args(0) {
2222
}
2323

2424
if ($json) {
25-
$c->res->code(400) if $res->{error};
26-
$c->stash->{json}{success} = $res->{error} ? \0 : \1;
25+
if ($res->{error}) {
26+
$c->res->code(400);
27+
$c->stash->{json}{success} = \0;
28+
$c->stash->{json}{error} = $res->{error};
29+
}
30+
else {
31+
$c->stash->{json}{success} = \1;
32+
}
2733
}
2834
else {
2935
$c->res->redirect(

0 commit comments

Comments
 (0)