Browse Source

Le chat a tout débranché

master
l4p1n 7 months ago
parent
commit
b2263977dd
Signed by: l4p1n <l4p1n@l4p1n.ch> GPG Key ID: 8A2C2F68B58DC35C
2 changed files with 10 additions and 1 deletions
  1. +9
    -0
      App/ApplicationHandler.php
  2. +1
    -1
      App/Lib/BotInteractor/API.php

+ 9
- 0
App/ApplicationHandler.php View File

@@ -3,6 +3,7 @@
namespace App;


use App\Lib\BotInteractor\APIException;
use League\Plates\Engine;
use League\Route\Http\Exception\ForbiddenException;
use League\Route\Http\Exception\NotFoundException;
@@ -47,6 +48,14 @@ class ApplicationHandler implements RequestHandlerInterface {
$response = (new Response)->withStatus(403);
$response->getBody()->write($templates->render('errors::403'));

return $response;
}catch (APIException $e){
/** @var Engine $templates */
$templates = $container->get(Engine::class);

$response = (new Response)->withStatus(500);
$response->getBody()->write($templates->render('errors::500'));

return $response;
}
}

+ 1
- 1
App/Lib/BotInteractor/API.php View File

@@ -15,7 +15,7 @@ class API {

public function __construct($bot_socket) {
$this->bot_socket = $bot_socket;
$this->socket = stream_socket_client("tcp://$bot_socket", $errno, $errstr);
$this->socket = @stream_socket_client("tcp://$bot_socket", $errno, $errstr);

if(!$this->socket){
if($errno != 0){