mirror of
https://github.com/snipe/snipe-it.git
synced 2026-02-04 15:35:52 +00:00
remove throwable exception..too vague
This commit is contained in:
@ -10,7 +10,10 @@ use App\Models\Location;
|
|||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Notifications\AuditNotification;
|
use App\Notifications\AuditNotification;
|
||||||
|
use GuzzleHttp\Exception\ClientException;
|
||||||
use GuzzleHttp\Exception\ConnectException;
|
use GuzzleHttp\Exception\ConnectException;
|
||||||
|
use GuzzleHttp\Exception\RequestException;
|
||||||
|
use GuzzleHttp\Exception\ServerException;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
@ -287,23 +290,32 @@ trait Loggable
|
|||||||
|
|
||||||
if(Setting::getSettings()->webhook_selected === 'microsoft' && Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
|
if(Setting::getSettings()->webhook_selected === 'microsoft' && Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) {
|
||||||
|
|
||||||
$endpoint = Setting::getSettings()->webhook_endpoint;
|
$endpoint = Setting::getSettings()->webhook_endpoint;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$message = AuditNotification::toMicrosoftTeams($params);
|
$message = AuditNotification::toMicrosoftTeams($params);
|
||||||
$notification = new TeamsNotification($endpoint);
|
$notification = new TeamsNotification($endpoint);
|
||||||
$notification->success()->sendMessage($message[0], $message[1]);
|
$notification->success()->sendMessage($message[0], $message[1]);
|
||||||
|
|
||||||
} catch (ConnectException $e) {
|
} catch (ServerException $e) {
|
||||||
Log::warning('Teams webhook connection failed', [
|
|
||||||
|
Log::error('Teams webhook server error', [
|
||||||
'endpoint' => $endpoint,
|
'endpoint' => $endpoint,
|
||||||
|
'status' => $e->getResponse()?->getStatusCode(),
|
||||||
'error' => $e->getMessage(),
|
'error' => $e->getMessage(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} catch (Throwable $e) {
|
} catch (ClientException $e) {
|
||||||
Log::error('Teams webhook failed unexpectedly', [
|
|
||||||
|
Log::warning('Teams webhook client error', [
|
||||||
|
'endpoint' => $endpoint,
|
||||||
|
'status' => $e->getResponse()?->getStatusCode(),
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
} catch (RequestException $e) {
|
||||||
|
|
||||||
|
Log::error('Teams webhook request failure', [
|
||||||
'endpoint' => $endpoint,
|
'endpoint' => $endpoint,
|
||||||
'exception' => get_class($e),
|
|
||||||
'error' => $e->getMessage(),
|
'error' => $e->getMessage(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user