Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix(hashnode): fail once when publishPost returns no post

Gilad Resisi0ffdbc9773d2
diff --git a/libraries/nestjs-libraries/src/integrations/social/hashnode.provider.ts b/libraries/nestjs-libraries/src/integrations/social/hashnode.provider.ts
index c0808a2c2..e55eee847 100644
--- a/libraries/nestjs-libraries/src/integrations/social/hashnode.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/hashnode.provider.ts
@@ -215,12 +215,12 @@ export class HashnodeProvider extends SocialAbstract implements SocialProvider {
})
).json();
- if (errors?.length) {
+ if (errors?.length || !data?.publishPost?.post) {
throw new BadBody(
this.identifier,
- JSON.stringify(errors),
+ JSON.stringify(errors || data || {}),
'{}',
- errors[0]?.message || 'Hashnode could not publish the post'
+ errors?.[0]?.message || 'Hashnode could not publish the post'
);
}