Skip to content

Commit

Permalink
feat: [589] add errors, sentry + fix wrong property
Browse files Browse the repository at this point in the history
  • Loading branch information
dragos1195 committed Jul 24, 2024
1 parent 383673d commit 3e12d76
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ export const ORGANIZATION_ERRORS = {
message: 'Error while uploading the files',
errorCode: 'ORG_010',
},
UPLOAD_NON_POLITICAL_AFFILIATION: {
message: 'Error while uploading the non political affiliation file',
errorCode: 'ORG_030',
},

UPLOAD_BALANCE_SHEET: {
message: 'Error while uploading the balance sheet file',
errorCode: 'ORG_031',
},
GET_REPORT: {
message: 'Report not found',
errorCode: 'ORG_011',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { UpdateOrganizationLegalDto } from '../dto/update-organization-legal.dto
import { OrganizationLegalRepository } from '../repositories';
import { ContactService } from './contact.service';
import { ORGANIZATION_FILES_DIR } from '../constants/files.constants';
import * as Sentry from '@sentry/node';

@Injectable()
export class OrganizationLegalService {
Expand Down Expand Up @@ -78,6 +79,7 @@ export class OrganizationLegalService {
error: { error },
...ORGANIZATION_ERRORS.UPLOAD,
});
Sentry.captureException(error);
if (error instanceof HttpException) {
throw error;
} else {
Expand Down Expand Up @@ -111,13 +113,14 @@ export class OrganizationLegalService {
} catch (error) {
this.logger.error({
error: { error },
...ORGANIZATION_ERRORS.UPLOAD,
...ORGANIZATION_ERRORS.UPLOAD_NON_POLITICAL_AFFILIATION,
});
Sentry.captureException(error);
if (error instanceof HttpException) {
throw error;
} else {
throw new InternalServerErrorException({
...ORGANIZATION_ERRORS.UPLOAD,
...ORGANIZATION_ERRORS.UPLOAD_NON_POLITICAL_AFFILIATION,
error,
});
}
Expand All @@ -144,13 +147,14 @@ export class OrganizationLegalService {
} catch (error) {
this.logger.error({
error: { error },
...ORGANIZATION_ERRORS.UPLOAD,
...ORGANIZATION_ERRORS.UPLOAD_BALANCE_SHEET,
});
Sentry.captureException(error);
if (error instanceof HttpException) {
throw error;
} else {
throw new InternalServerErrorException({
...ORGANIZATION_ERRORS.UPLOAD,
...ORGANIZATION_ERRORS.UPLOAD_BALANCE_SHEET,
error,
});
}
Expand Down Expand Up @@ -231,6 +235,7 @@ export class OrganizationLegalService {
...ORGANIZATION_ERRORS.DELETE.STATUTE,
});

Sentry.captureException(error);
const err = error?.response;
throw new InternalServerErrorException({
...ORGANIZATION_ERRORS.DELETE.STATUTE,
Expand Down Expand Up @@ -265,6 +270,7 @@ export class OrganizationLegalService {
error,
...ORGANIZATION_ERRORS.DELETE.NON_POLITICAL_AFFILIATION,
});
Sentry.captureException(error);

const err = error?.response;
throw new InternalServerErrorException({
Expand Down Expand Up @@ -300,6 +306,7 @@ export class OrganizationLegalService {
...ORGANIZATION_ERRORS.DELETE.BALANCE_SHEET,
});

Sentry.captureException(error);
const err = error?.response;
throw new InternalServerErrorException({
...ORGANIZATION_ERRORS.DELETE.BALANCE_SHEET,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,7 @@ export class OrganizationService {
await this.fileManagerService.generatePresignedURL(
organization.organizationLegal.balanceSheetFile,
);
organization.organizationLegal.nonPoliticalAffiliationFile =
balanceSheetFile;
organization.organizationLegal.balanceSheetFile = balanceSheetFile;
}

return organization;
Expand Down

0 comments on commit 3e12d76

Please sign in to comment.