Skip to content

A free open source IT asset/license management system

readd connection and throwable

Godfrey Mb45efddd9a64
diff --git a/app/Models/Traits/Loggable.php b/app/Models/Traits/Loggable.php
index f2eecc93eb..84a24d80bf 100644
--- a/app/Models/Traits/Loggable.php
+++ b/app/Models/Traits/Loggable.php
@@ -11,12 +11,14 @@ use App\Models\Setting;
use App\Models\User;
use App\Notifications\AuditNotification;
use GuzzleHttp\Exception\ClientException;
+use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ServerException;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use Osama\LaravelTeamsNotification\TeamsNotification;
+use Throwable;
trait Loggable
{
@@ -295,6 +297,12 @@ trait Loggable
$notification = new TeamsNotification($endpoint);
$notification->success()->sendMessage($message[0], $message[1]);
+ } catch (ConnectException $e) {
+ Log::warning('Teams webhook connection failed', [
+ 'endpoint' => $endpoint,
+ 'error' => $e->getMessage()
+ ]);
+
} catch (ServerException $e) {
Log::error('Teams webhook server error', [
@@ -316,6 +324,12 @@ trait Loggable
'endpoint' => $endpoint,
'error' => $e->getMessage(),
]);
+ }catch (Throwable $e) {
+ Log::error('Teams webhook failed unexpectedly', [
+ 'endpoint' => $endpoint,
+ 'exception' => get_class($e),
+ 'error' => $e->getMessage(),
+ ]);
}
}
else {