From 67147e18a396c948ed7c55d3838ed382b3236d3e Mon Sep 17 00:00:00 2001 From: Nevo David Date: Fri, 11 Jul 2025 19:27:10 +0700 Subject: [PATCH] feat: bad body in case of a different error --- .../src/database/prisma/posts/posts.service.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts b/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts index 9cf63db6..6863b7a8 100644 --- a/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts +++ b/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts @@ -338,7 +338,12 @@ export class PostsService { return; } } catch (err: any) { - await this._postRepository.changeState(firstPost.id, 'ERROR', err, allPosts); + await this._postRepository.changeState( + firstPost.id, + 'ERROR', + err, + allPosts + ); if (err instanceof BadBody) { await this._notificationService.inAppNotification( firstPost.organizationId, @@ -388,7 +393,7 @@ export class PostsService { private async postSocial( integration: Integration, posts: Post[], - forceRefresh = false, + forceRefresh = false ): Promise> { const getIntegration = this._integrationManager.getSocialIntegration( integration.providerIdentifier @@ -525,7 +530,11 @@ export class PostsService { return this.postSocial(integration, posts, true); } - throw err; + if (err instanceof BadBody) { + throw err; + } + + throw new BadBody(integration.providerIdentifier, JSON.stringify(err), {} as any, ''); } }