Skip to content

fix(SUP-45003): [IKEA Ingka] - past scheduled embedded entries will show a wrong error message for V7 player #897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 25, 2024
Merged
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
10 changes: 9 additions & 1 deletion src/common/utils/error-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@ import { Error } from '@playkit-js/playkit-js';
const isBackEndError = (error: Error): boolean => error.category === 2;
const isBlockAction = (error: Error): boolean => error.code === 2001;
const isMediaNotReady = (error: Error): boolean => error.code === 2002;
const isScheduledRestrictedCode = (error: Error): boolean => error.code === 2003;
const isGeolocationRestricted = (error: Error): boolean => error.data?.messages && error.data?.messages[0].code === 'COUNTRY_RESTRICTED';
const isSessionRestricted = (error: Error): boolean => error.data?.messages && error.data?.messages[0].code === 'SESSION_RESTRICTED';
const isIPRestricted = (error: Error): boolean => error.data?.messages && error.data?.messages[0].code === 'IP_RESTRICTED';
const isSitedRestricted = (error: Error): boolean => error.data?.messages && error.data?.messages[0].code === 'SITE_RESTRICTED';
const isScheduledRestricted = (error: Error): boolean => error.data?.messages && error.data?.messages[0].code === 'SCHEDULED_RESTRICTED';

const isSessionRestrictedError = (error: Error): boolean => isBackEndError(error) && isBlockAction(error) && isSessionRestricted(error);
const isGeolocationError = (error: Error): boolean => isBackEndError(error) && isBlockAction(error) && isGeolocationRestricted(error);
const isMediaNotReadyError = (error: Error): boolean => isBackEndError(error) && isMediaNotReady(error);
const isIPRestrictedError = (error: Error): boolean => isBackEndError(error) && isBlockAction(error) && isIPRestricted(error);
const isSitedRestrictedError = (error: Error): boolean => isBackEndError(error) && isBlockAction(error) && isSitedRestricted(error);
const isScheduledRestrictedError = (error: Error): boolean =>
isBackEndError(error) && isScheduledRestrictedCode(error) && isScheduledRestricted(error);

const conditionsToErrors: any[] = [
[isSessionRestrictedError, Error.Category.MEDIA_UNAVAILABLE],
[isGeolocationError, Error.Category.GEO_LOCATION],
[isMediaNotReadyError, Error.Category.MEDIA_NOT_READY],
[isIPRestrictedError, Error.Category.IP_RESTRICTED]
[isIPRestrictedError, Error.Category.IP_RESTRICTED],
[isScheduledRestrictedError, Error.Category.SCHEDULED_RESTRICTED],
[isSitedRestrictedError, Error.Category.SITE_RESTRICTED]
];

function getErrorCategory(error: Error): number {
Expand Down
Loading