Skip to content
Snippets Groups Projects
Commit 8dfdf08c authored by Etienne LOUPIAS's avatar Etienne LOUPIAS
Browse files

fix(map): avoid error 500 if no structure position

parent a8b5162a
No related branches found
No related tags found
1 merge request!345V2.4.2
import { Body, Controller, Logger, Post, UseGuards } from '@nestjs/common';
import { Body, Controller, HttpException, HttpStatus, Logger, Post, UseGuards } from '@nestjs/common';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { Roles } from '../users/decorators/roles.decorator';
......@@ -37,6 +37,12 @@ export class TclStopPointController {
})
@Post('/closest')
public getClosestStopPoints(@Body() pgisCoord: PgisCoord): Promise<TclStopPoint[]> {
if (pgisCoord.coordinates.includes(null)) {
throw new HttpException(
`Invalid empty coordinate: ${JSON.stringify(pgisCoord.coordinates)}`,
HttpStatus.BAD_REQUEST
);
}
return this.tclStopPointService.getClosestStopPoints(pgisCoord);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment