diff --git a/layouts/partials/highfive.html b/layouts/partials/highfive.html index a40c668..0ff1f1f 100644 --- a/layouts/partials/highfive.html +++ b/layouts/partials/highfive.html @@ -38,9 +38,14 @@ {{ $resource := resources.GetRemote $apiUrl }} {{ $initialCount := 0 }} {{ if $resource }} - {{ $highfiveData := $resource | transform.Unmarshal }} - {{ if $highfiveData.count }} - {{ $initialCount = $highfiveData.count }} + {{ with $resource.Err }} + {{ warnf "Failed to fetch highfive data from %s: %s" $apiUrl . }} + {{ $initialCount = 0 }} + {{ else }} + {{ $highfiveData := $resource | transform.Unmarshal }} + {{ if $highfiveData.count }} + {{ $initialCount = $highfiveData.count }} + {{ end }} {{ end }} {{ end }} @@ -117,6 +122,10 @@ return { ...data, alreadyHighFived: true }; } + if (response.status === 400) { + return {count: 0} + } + if (!response.ok) { throw new Error(`HTTP ${response.status}: ${response.statusText}`); }