mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2025-12-24 18:00:16 +00:00
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:
@@ -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)
|
||||
=> [
|
||||
|
||||
Reference in New Issue
Block a user