feat: add error handling (#14)

* Remove commented out crap
* Update theme to use some colors from catppuccin, add error handling for API/DB
This commit is contained in:
Frankie B 2023-09-08 23:19:40 +01:00 committed by GitHub
commit 26901f8222
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 85 additions and 15 deletions

View file

@ -7,6 +7,19 @@
$cfg = app('config')->get('services')['lastfm'];
$api_root = app('config')->get('app')['api_root'];
$api_alive = true;
try {
$data = file_get_contents($api_root.'/lastfm/current');
} catch (Exception $e) {
$api_alive = false;
}
@endphp
@if (!$api_alive)
@include('components.errors.api-error')
@else
@php
$current_track = json_decode(file_get_contents($api_root . '/lastfm/current'));
$top_tracks = json_decode(file_get_contents($api_root . '/lastfm/top'));
$count = 0;
@ -51,4 +64,5 @@
</tr>
@endforeach
</table>
@endif
@stop