mirror of
https://gitlab.com/mobicoop/v3/service/matcher.git
synced 2026-01-01 06:22:40 +00:00
Define an exception filter to log the cause of exceptions
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
import { QueryBase } from '@mobicoop/ddd-library';
|
||||
import { AlgorithmType } from '../../types/algorithm.types';
|
||||
import { Waypoint } from '../../types/waypoint.type';
|
||||
import { Frequency, Role } from '@modules/ad/core/domain/ad.types';
|
||||
import { MatchRequestDto } from '@modules/ad/interface/grpc-controllers/dtos/match.request.dto';
|
||||
import { DateTimeTransformerPort } from '../../ports/datetime-transformer.port';
|
||||
import {
|
||||
Path,
|
||||
PathCreator,
|
||||
@@ -11,8 +7,12 @@ import {
|
||||
TypedRoute,
|
||||
} from '@modules/ad/core/domain/path-creator.service';
|
||||
import { Point } from '@modules/ad/core/domain/value-objects/point.value-object';
|
||||
import { Route } from '../../types/route.type';
|
||||
import { MatchRequestDto } from '@modules/ad/interface/grpc-controllers/dtos/match.request.dto';
|
||||
import { DateTimeTransformerPort } from '../../ports/datetime-transformer.port';
|
||||
import { GeorouterPort } from '../../ports/georouter.port';
|
||||
import { AlgorithmType } from '../../types/algorithm.types';
|
||||
import { Route } from '../../types/route.type';
|
||||
import { Waypoint } from '../../types/waypoint.type';
|
||||
|
||||
export class MatchQuery extends QueryBase {
|
||||
id?: string;
|
||||
@@ -227,7 +227,9 @@ export class MatchQuery extends QueryBase {
|
||||
}
|
||||
});
|
||||
} catch (e: any) {
|
||||
throw new Error('Unable to find a route for given waypoints');
|
||||
throw new Error('Unable to find a route for given waypoints', {
|
||||
cause: e,
|
||||
});
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
@@ -6,12 +6,20 @@ import { MatchingResult } from '@modules/ad/core/application/queries/match/match
|
||||
import { MatchEntity } from '@modules/ad/core/domain/match.entity';
|
||||
import { MatchMapper } from '@modules/ad/match.mapper';
|
||||
import { CacheInterceptor, CacheKey } from '@nestjs/cache-manager';
|
||||
import { Controller, Inject, UseInterceptors, UsePipes } from '@nestjs/common';
|
||||
import {
|
||||
Controller,
|
||||
Inject,
|
||||
UseFilters,
|
||||
UseInterceptors,
|
||||
UsePipes,
|
||||
} from '@nestjs/common';
|
||||
import { QueryBus } from '@nestjs/cqrs';
|
||||
import { GrpcMethod } from '@nestjs/microservices';
|
||||
import { LogCauseExceptionFilter } from '@src/log-cause.exception-filter';
|
||||
import { MatchingPaginatedResponseDto } from '../dtos/matching.paginated.response.dto';
|
||||
import { MatchRequestDto } from './dtos/match.request.dto';
|
||||
|
||||
@UseFilters(LogCauseExceptionFilter)
|
||||
@UsePipes(
|
||||
new RpcValidationPipe({
|
||||
whitelist: false,
|
||||
|
||||
Reference in New Issue
Block a user