Corrected handling of warn messages
diff --git a/lib/Korap.pm b/lib/Korap.pm
index 0dc9655..b8b60a3 100644
--- a/lib/Korap.pm
+++ b/lib/Korap.pm
@@ -48,6 +48,7 @@
'/sass/table.scss',
'/sass/pagination.scss',
'/sass/kwic-4.0.scss',
+ '/sass/alertify.scss',
'/css/media.css',
'/css/font-awesome.min.css',
'/css/highlight.css'
diff --git a/lib/Korap/Plugin/KorapSearch.pm b/lib/Korap/Plugin/KorapSearch.pm
index 171c6e1..d42ae61 100644
--- a/lib/Korap/Plugin/KorapSearch.pm
+++ b/lib/Korap/Plugin/KorapSearch.pm
@@ -169,15 +169,20 @@
$c->chi->set('total-' . $cache_url => $json->{totalResults}, '30min');
};
+ if ($json->{warning}) {
+ $c->notify(warn => $json->{warning});
+ };
+
if ($json->{error}) {
- $c->notify('error' => $json->{error});
+ $c->notify(error => $json->{error});
};
}
# Request failed
else {
my $res = $tx->res;
- $c->notify('error' => $res->{code} . ': ' . $res->{message} . ' (remote)');
+ $c->notify(error => ($res->{code} ? $res->{code} . ': ' : '') .
+ $res->{message} . ' (remote)');
};
# Run embedded template