Skip to content

Commit

Permalink
fix(SUP-45003): [IKEA Ingka] - past scheduled embedded entries will s…
Browse files Browse the repository at this point in the history
…how a wrong error message for V7 player (#897)

Description of the Changes
Adding error messages to site restriction and scheduled restriction

Part of - kaltura/playkit-js-ui#970, kaltura/playkit-js#805, kaltura/playkit-js-providers#245

Resolves SUP-45003
  • Loading branch information
Tzipi-kaltura authored Dec 25, 2024
1 parent d4f707b commit 5cd24c1
Showing 1 changed file with 9 additions and 1 deletion.
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

0 comments on commit 5cd24c1

Please sign in to comment.