Improve error handling

pull/239/head
Thomas 3 years ago
parent 34c13c80ec
commit d6a16a6093

@ -278,9 +278,19 @@ export class PortfolioController {
@UseGuards(AuthGuard('jwt'))
public async getPositions(
@Headers('impersonation-id') impersonationId,
@Query('range') range
@Query('range') range,
@Res() res: Response
): Promise<PortfolioPositions> {
return await this.portfolioService.getPositions(impersonationId, range);
const result = await this.portfolioService.getPositions(
impersonationId,
range
);
if (result?.hasErrors) {
res.status(StatusCodes.ACCEPTED);
}
return <any>res.json(result);
}
@Get('position/:symbol')

Loading…
Cancel
Save