From ab97a2dac4d82a6314e1f480498296eab644e731 Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Tue, 9 Mar 2021 17:30:41 +0100 Subject: [PATCH] fix: update error handling on post controller + update ghost insert script --- scripts/ghost/migrations/init/posts.json | 4 ++-- src/posts/posts.controller.ts | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/ghost/migrations/init/posts.json b/scripts/ghost/migrations/init/posts.json index 4a76cf149..1cadc680a 100644 --- a/scripts/ghost/migrations/init/posts.json +++ b/scripts/ghost/migrations/init/posts.json @@ -684,7 +684,7 @@ "codeinjection_foot": null, "custom_template": null, "canonical_url": null, - "tags": ["Infos"], + "tags": ["Infos", "Oullins"], "authors": [ { "id": "5951f5fca366002ebd5dbef7", @@ -806,7 +806,7 @@ "codeinjection_foot": null, "custom_template": null, "canonical_url": null, - "tags": ["Ressources"], + "tags": ["Ressources", "Oullins"], "authors": [ { "id": "5951f5fca366002ebd5dbef7", diff --git a/src/posts/posts.controller.ts b/src/posts/posts.controller.ts index dcc6aecfd..a70393a1b 100644 --- a/src/posts/posts.controller.ts +++ b/src/posts/posts.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, HttpService, Logger, Param, Query } from '@nestjs/common'; +import { Controller, Get, HttpException, HttpService, HttpStatus, Logger, Param, Query } from '@nestjs/common'; import { Observable } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { ApiQuery } from '@nestjs/swagger'; @@ -35,8 +35,7 @@ export class PostsController { .pipe( map((response) => response.data), catchError((err) => { - Logger.error(err); - return new Observable(); + throw new HttpException('Invalid structure id', HttpStatus.BAD_REQUEST); }) ); } -- GitLab