Commit ed21649e authored by FORESTIER Fabien's avatar FORESTIER Fabien
Browse files

Make sure errors are displayed as string in logger (avoids error)

parent fca9e382
Pipeline #2377 passed with stages
in 51 seconds
......@@ -40,7 +40,7 @@ export class LinksService {
}
const linksCount = await qb.getCount().catch((error) => {
this.logger.error(`Error while getting the count of links.`, error, `${LinksService.name} - ${this.findAll.name}`);
this.logger.error(`Error while getting the count of links.`, `${error}`, `${LinksService.name} - ${this.findAll.name}`);
throw new InternalServerErrorException({ error, message: 'Error while getting the count of links.' });
});
......@@ -53,7 +53,7 @@ export class LinksService {
}
const links = await qb.getMany().catch((error) => {
this.logger.error(`Error while getting the list of link.`, error, `${LinksService.name} - ${this.findAll.name}`);
this.logger.error(`Error while getting the list of link.`, `${error}`, `${LinksService.name} - ${this.findAll.name}`);
throw new InternalServerErrorException({ error, message: 'Error while getting the list of links.' });
});
......@@ -68,7 +68,7 @@ export class LinksService {
this.logger.log('Entering function', `${LinksService.name} - ${this.findOne.name}`);
return await this.linkRepository.findOne(id).catch((error) => {
this.logger.error(`Error while looking for the link with id ${id}.`, error, `${LinksService.name} - ${this.findOne.name}`);
this.logger.error(`Error while looking for the link with id ${id}.`, `${error}`, `${LinksService.name} - ${this.findOne.name}`);
throw new InternalServerErrorException({ error, message: 'Error while looking for the link with id ${id}.' });
});
} catch (error) {
......@@ -81,7 +81,7 @@ export class LinksService {
this.logger.log('Entering function', `${LinksService.name} - ${this.create.name}`);
return await this.linkRepository.save(link).catch((error) => {
this.logger.error(`Error saving the link into the database.`, error, `${LinksService.name} - ${this.create.name}`);
this.logger.error(`Error saving the link into the database.`, `${error}`, `${LinksService.name} - ${this.create.name}`);
throw new InternalServerErrorException({ error, message: 'Error saving the link into the database.' });
});
} catch (error) {
......@@ -94,14 +94,14 @@ export class LinksService {
this.logger.log('Entering function', `${LinksService.name} - ${this.update.name}`);
const toUpdate = await this.linkRepository.findOne(id).catch((error) => {
this.logger.error(`Error while looking for the link with the id ${id}.`, error, `${LinksService.name} - ${this.update.name}`);
this.logger.error(`Error while looking for the link with the id ${id}.`, `${error}`, `${LinksService.name} - ${this.update.name}`);
throw new InternalServerErrorException({ error, message: 'Error while looking for the link.' });
});
const updated = Object.assign(toUpdate, link);
return await this.linkRepository.save(updated).catch((error) => {
this.logger.error(`Error while updating the resource.`, error, `${LinksService.name} - ${this.update.name}`);
this.logger.error(`Error while updating the resource.`, `${error}`, `${LinksService.name} - ${this.update.name}`);
throw new InternalServerErrorException({ error, message: 'Error while updating the link.' });
});
} catch (error) {
......@@ -120,7 +120,7 @@ export class LinksService {
}
return await this.linkRepository.delete(id).catch((error) => {
this.logger.error(`Error while deleting the link with id ${id}.`, error, `${LinksService.name} - ${this.delete.name}`);
this.logger.error(`Error while deleting the link with id ${id}.`, `${error}`, `${LinksService.name} - ${this.delete.name}`);
throw new InternalServerErrorException({ error, message: `Error while deleting the link with id ${id}.` });
});
} catch (error) {
......@@ -139,7 +139,7 @@ export class LinksService {
orphanRO.links.forEach(orphan => {
this.linkRepository.delete(orphan).catch((error) => {
this.logger.error(`Error while deleting orphan with id: ${orphan}`, error, `${LinksService.name} - ${this.deleteOrphans.name}`);
this.logger.error(`Error while deleting orphan with id: ${orphan}`, `${error}`, `${LinksService.name} - ${this.deleteOrphans.name}`);
throw new InternalServerErrorException({ error, message: `Error while deleting orphan with id: ${orphan}` });
});
});
......
......@@ -35,7 +35,7 @@ export class OrganizationsService {
}
const organizationsCount = await qb.getCount().catch((error) => {
this.logger.error(`Error while getting the count of organizations.`, error, `${OrganizationsService.name} - ${this.findAll.name}`);
this.logger.error(`Error while getting the count of organizations.`, `${error}`, `${OrganizationsService.name} - ${this.findAll.name}`);
throw new InternalServerErrorException({ error, message: 'Error while getting the count of organizations.' });
});
......@@ -48,7 +48,7 @@ export class OrganizationsService {
}
const organizations = await qb.getMany().catch((error) => {
this.logger.error(`Error while getting the list of organizations.`, error, `${OrganizationsService.name} - ${this.findAll.name}`);
this.logger.error(`Error while getting the list of organizations.`, `${error}`, `${OrganizationsService.name} - ${this.findAll.name}`);
throw new InternalServerErrorException({ error, message: 'Error while getting the list of organizations.' });
});
......@@ -63,7 +63,7 @@ export class OrganizationsService {
this.logger.log('Entering function', `${OrganizationsService.name} - ${this.findOne.name}`);
const organization = await this.organizationRepository.findOne(id).catch((error) => {
this.logger.error(`Error while looking the organization with id ${id}.`, error, `${OrganizationsService.name} - ${this.findOne.name}`);
this.logger.error(`Error while looking the organization with id ${id}.`, `${error}`, `${OrganizationsService.name} - ${this.findOne.name}`);
throw new InternalServerErrorException({ error, message: 'Error while looking the organization with id ${id}.' });
});
......@@ -79,7 +79,7 @@ export class OrganizationsService {
const organization = await this.organizationRepository.findOne(id).catch((error) => {
this.logger.error(
`Error while looking for the link of the organization with id ${id}.`, error, `${OrganizationsService.name} - ${this.findLinks.name}`,
`Error while looking for the link of the organization with id ${id}.`, `${error}`, `${OrganizationsService.name} - ${this.findLinks.name}`,
);
throw new InternalServerErrorException({ error, message: 'Error while looking for the link of the organization with id ${id}.' });
});
......@@ -101,7 +101,7 @@ export class OrganizationsService {
// organization.logo = await this._fileManagementService.upload('local-actors-logo', logoImage);
const organizationCreated = await this.organizationRepository.save(organization).catch((error) => {
this.logger.error(`Error saving the organization into the database.`, error, `${OrganizationsService.name} - ${this.create.name}`);
this.logger.error(`Error saving the organization into the database.`, `${error}`, `${OrganizationsService.name} - ${this.create.name}`);
throw new InternalServerErrorException({ error, message: 'Error saving the organization into the database.' });
});
......@@ -110,7 +110,7 @@ export class OrganizationsService {
return organizationCreated;
} catch (error) {
this.logger.error('Failed to create the organization.', error, `${OrganizationsService.name} - ${this.create.name}`);
this.logger.error('Failed to create the organization.', `${error}`, `${OrganizationsService.name} - ${this.create.name}`);
throw error;
}
}
......@@ -120,7 +120,7 @@ export class OrganizationsService {
this.logger.log('Entering function', `${OrganizationsService.name} - ${this.update.name}`);
const toUpdate = await this.organizationRepository.findOne(id).catch((error) => {
this.logger.error(`Error while looking for the organization with the id ${id}.`, error, `${OrganizationsService.name} - ${this.update.name}`);
this.logger.error(`Error while looking for the organization with the id ${id}.`, `${error}`, `${OrganizationsService.name} - ${this.update.name}`);
throw new InternalServerErrorException({ error, message: 'Error while looking for the organization.' });
});
......@@ -130,7 +130,7 @@ export class OrganizationsService {
const updated = Object.assign(toUpdate, organization);
const saved = await this.organizationRepository.save(updated).catch((error) => {
this.logger.error(`Error while updating the organization.`, error, `${OrganizationsService.name} - ${this.update.name}`);
this.logger.error(`Error while updating the organization.`, `${error}`, `${OrganizationsService.name} - ${this.update.name}`);
throw new InternalServerErrorException({ error, message: 'Error while updating the organization.' });
});
......@@ -147,7 +147,7 @@ export class OrganizationsService {
this.logger.log('Entering function', `${OrganizationsService.name} - ${this.delete.name}`);
const toDelete = await this.organizationRepository.findOne(id).catch((error) => {
this.logger.error(`Error while looking the organization with id ${id}.`, error, `${OrganizationsService.name} - ${this.delete.name}`);
this.logger.error(`Error while looking the organization with id ${id}.`, `${error}`, `${OrganizationsService.name} - ${this.delete.name}`);
throw new InternalServerErrorException({ error, message: 'Error while looking the organization with id ${id}.' });
});
......@@ -156,7 +156,7 @@ export class OrganizationsService {
}
return await this.organizationRepository.delete(id).catch((error) => {
this.logger.error(`Error while deleting the organization with id ${id}.`, error, `${OrganizationsService.name} - ${this.delete.name}`);
this.logger.error(`Error while deleting the organization with id ${id}.`, `${error}`, `${OrganizationsService.name} - ${this.delete.name}`);
throw new InternalServerErrorException({ error, message: 'Error while deleting the organization with id ${id}.' });
});
} catch (error) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment