Don't track errors

Change-Id: I4bc012a3718d8b932ea4af762acfc5b8d2be2e56
diff --git a/lib/Kalamar/Plugin/Piwik.pm b/lib/Kalamar/Plugin/Piwik.pm
index 670ea78..0bf3bf6 100644
--- a/lib/Kalamar/Plugin/Piwik.pm
+++ b/lib/Kalamar/Plugin/Piwik.pm
@@ -84,6 +84,9 @@
       after_render => sub {
         my $c = shift;
 
+        # Don't track errors
+        return if $c->res->is_error;
+
         # Only track valid routes
         my $route = $c->current_route or return;
 
@@ -103,8 +106,11 @@
           $hash->{idsite} = $param->{ping_site_id}
         };
 
-        # Send track
-        $c->piwik->api_p(Track => $hash)->wait;
+        $c->piwik->api_p(Track => $hash)->catch(
+          sub {
+            $c->app->log->debug("Matomo track failed: $_[0]");
+          }
+        );
       }
     );
   };