From dc4ebe0132480d6b3344edc18ab8626f69bee59d Mon Sep 17 00:00:00 2001 From: Florimond Manca Date: Wed, 4 Dec 2024 12:32:59 +0100 Subject: [PATCH] Log Mattermost notifier exception (#450) --- 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..8253eb91 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 { 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); } } }