Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
status: number
):
| {
type: 'refresh-token' | 'bad-body';
type: 'refresh-token' | 'bad-body' | 'retry';
value: string;
}
| undefined {
Expand Down Expand Up @@ -207,6 +207,43 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
value: 'Facebook return: No permission to publish the video',
};
}
if (/"error_subcode":459\b/.test(body)) {
return {
type: 'bad-body' as const,
value:
'Facebook is asking you to resolve a security check. Log in at facebook.com, complete it, then try again',
};
}
if (/"error_subcode":492\b/.test(body)) {
return {
type: 'bad-body' as const,
value:
'Your Facebook user no longer has a role on this Page. Ask a Page admin to grant you a role, then reconnect the channel',
};
}
if (body.indexOf('must be granted before impersonating') > -1) {
return {
type: 'refresh-token' as const,
value:
'Facebook Page permissions are missing, please reconnect the channel and allow all permissions',
};
}
if (
/"error_subcode":33\b/.test(body) &&
body.indexOf('does not exist') > -1
) {
return {
type: 'bad-body' as const,
value:
'The Facebook Page or post this was targeting no longer exists, please reconnect the channel and schedule again',
};
Comment on lines +231 to +239

This comment was marked as outdated.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid, fixed in the follow-up commit: the three subcode checks (33, 459, 492) now test /"error_subcode":NNN\b/ so a trailing digit no longer matches. Re-verified against all 1,827 production bodies (same 655 mapped, everything else still undefined) plus negative cases for 330, 4590 and 4920.

}
if (body.indexOf('Sorry, something went wrong') > -1) {
return {
type: 'retry' as const,
value: 'Facebook is temporarily unavailable, please try again later',
};
}
if (body.indexOf('490') > -1) {
return {
type: 'refresh-token' as const,
Expand Down
Loading