Skip to content

Commit 6859f0d

Browse files
committed
feat: retry no activity
1 parent 82d91fd commit 6859f0d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { LinkedinDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-sett
1515
import imageToPDF from 'image-to-pdf';
1616
import { Readable } from 'stream';
1717
import { Rules } from '@gitroom/nestjs-libraries/chat/rules.description.decorator';
18+
import { string } from 'yup';
1819

1920
@Rules(
2021
'LinkedIn can have maximum one attachment when selecting video, when choosing a carousel on LinkedIn minimum amount of attachment must be two, and only pictures, if uploading a video, LinkedIn can have only one attachment'
@@ -40,6 +41,22 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
4041
maxLength() {
4142
return 3000;
4243
}
44+
45+
override handleErrors(
46+
body: string
47+
):
48+
| { type: 'refresh-token' | 'bad-body' | 'retry'; value: string }
49+
| undefined {
50+
if (body.indexOf('Unable to obtain activity') > -1) {
51+
return {
52+
type: 'retry',
53+
value: 'Unable to obtain activity',
54+
};
55+
}
56+
57+
return undefined;
58+
}
59+
4360
async refreshToken(refresh_token: string): Promise<AuthTokenDetails> {
4461
const {
4562
access_token: accessToken,

0 commit comments

Comments
 (0)