Merge pull request #20 from movie-web/fix/improve-error-message

Improve "Domain is not whitelisted" error message
This commit is contained in:
Jorrin
2024-03-03 13:45:24 +01:00
committed by GitHub

View File

@@ -31,5 +31,9 @@ export const isDomainWhitelisted = async (url: string | undefined) => {
export const assertDomainWhitelist = async (url: string) => {
const isWhiteListed = await isDomainWhitelisted(url);
if (!isWhiteListed) throw new Error('Domain is not whitelisted');
const currentDomain = makeUrlIntoDomain(url);
if (!isWhiteListed)
throw new Error(
`${currentDomain} is not whitelisted. Open the extension and click on the power button to whitelist the site.`,
);
};