From 12a3facdc440cfc33b2f4a869be50982024bc059 Mon Sep 17 00:00:00 2001 From: florimondmanca Date: Wed, 4 Dec 2024 12:25:21 +0100 Subject: [PATCH] Log Mattermost notifier exception --- src/Infrastructure/Adapter/MattermostNotifier.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Infrastructure/Adapter/MattermostNotifier.ts b/src/Infrastructure/Adapter/MattermostNotifier.ts index 0487e1d2..c5214f48 100644 --- a/src/Infrastructure/Adapter/MattermostNotifier.ts +++ b/src/Infrastructure/Adapter/MattermostNotifier.ts @@ -1,5 +1,5 @@ import { HttpService } from '@nestjs/axios'; -import { BadGatewayException, Injectable } from '@nestjs/common'; +import { BadGatewayException, Injectable, InternalServerErrorException } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { IMattermostNotifier } from 'src/Application/IMattermostNotifier'; @@ -29,7 +29,7 @@ export class MattermostNotifier implements IMattermostNotifier { return response.data; } catch (e) { - throw BadGatewayException; + throw new InternalServerErrorException(e); } } @@ -55,12 +55,10 @@ export class MattermostNotifier implements IMattermostNotifier { } ); - console.log(response.data); - return response.data; } catch (e) { - console.log('--error: ', e); - throw BadGatewayException; + console.error('--error: ', e); + throw new InternalServerErrorException(e); } } @@ -87,7 +85,7 @@ export class MattermostNotifier implements IMattermostNotifier { return response.data; } catch (e) { - throw BadGatewayException; + throw new InternalServerErrorException(e); } } }