feat: Add error handling for relay server response and custom error pages

This commit includes the following changes:
- Added error handling in the election views to check if the relay server responds with an error message
- Included custom error pages for different HTTP status codes (401, 402, 403, 404, 419, 429, 500, 503)
- Created a new layout for the error pages
This commit is contained in:
fsociety
2024-09-29 19:51:13 +02:00
parent 5ba881dd60
commit 0dd577e9d5
12 changed files with 137 additions and 0 deletions

View File

@@ -134,6 +134,11 @@ $loadEvents = function () {
$request = new Request($relaySet, $requestMessage);
$response = $request->send();
// Check for errors in the response
if (isset($response[config('services.relay')][0][0]) && $response[config('services.relay')][0][0] === 'ERROR') {
abort(500, 'Kann keine Events laden. Nostr Relay antwortet nicht.');
}
$this->events = collect($response[config('services.relay')])
->map(fn($event)
=> [