Changed statistic name
diff --git a/lib/Korap/Plugin/KorapSearch.pm b/lib/Korap/Plugin/KorapSearch.pm
index 9d95026..89faeff 100644
--- a/lib/Korap/Plugin/KorapSearch.pm
+++ b/lib/Korap/Plugin/KorapSearch.pm
@@ -182,8 +182,13 @@
# Request failed
else {
my $res = $tx->res;
- $c->notify(error => ($res->{code} ? $res->{code} . ': ' : '') .
- $res->{message} . ' (remote)');
+ if (my $error = $res->json('/error')) {
+ $c->notify(error => $error);
+ }
+ else {
+ $c->notify(error => ($res->{code} ? $res->{code} . ': ' : '') .
+ $res->{message} . ' (remote)');
+ };
};
# Run embedded template