diff --git a/src/main/services/achievements/merge-achievements.ts b/src/main/services/achievements/merge-achievements.ts index 277b265e..84302e73 100644 --- a/src/main/services/achievements/merge-achievements.ts +++ b/src/main/services/achievements/merge-achievements.ts @@ -8,6 +8,7 @@ import { HydraApi } from "../hydra-api"; import { getUnlockedAchievements } from "@main/events/user/get-unlocked-achievements"; import { Game } from "@main/entity"; import { achievementsLogger } from "../logger"; +import { SubscriptionRequiredError } from "@shared"; const saveAchievementsOnLocal = async ( objectId: string, @@ -141,7 +142,10 @@ export const mergeAchievements = async ( ); }) .catch((err) => { - achievementsLogger.error(err); + if (err! instanceof SubscriptionRequiredError) { + achievementsLogger.error(err); + } + return saveAchievementsOnLocal( game.objectID, game.shop, diff --git a/src/main/services/hydra-api.ts b/src/main/services/hydra-api.ts index 1b1c3663..1c027dec 100644 --- a/src/main/services/hydra-api.ts +++ b/src/main/services/hydra-api.ts @@ -8,10 +8,7 @@ import url from "url"; import { uploadGamesBatch } from "./library-sync"; import { clearGamesRemoteIds } from "./library-sync/clear-games-remote-id"; import { logger } from "./logger"; -import { - UserNotLoggedInError, - UserWithoutCloudSubscriptionError, -} from "@shared"; +import { UserNotLoggedInError, SubscriptionRequiredError } from "@shared"; // import { omit } from "lodash-es"; import { appVersion } from "@main/constants"; import { omit } from "lodash-es"; @@ -40,7 +37,6 @@ export class HydraApi { } private static async hasCloudSubscription() { - // TODO change this later, this is just a quick test return userSubscriptionRepository .findOne({ where: { id: 1 } }) .then((userSubscription) => { @@ -262,7 +258,7 @@ export class HydraApi { if (needsCloud) { if (!(await this.hasCloudSubscription())) { - throw new UserWithoutCloudSubscriptionError(); + throw new SubscriptionRequiredError(); } } } diff --git a/src/shared/index.ts b/src/shared/index.ts index c2a98c8a..1f17ac56 100644 --- a/src/shared/index.ts +++ b/src/shared/index.ts @@ -10,7 +10,7 @@ export class UserNotLoggedInError extends Error { } } -export class UserWithoutCloudSubscriptionError extends Error { +export class SubscriptionRequiredError extends Error { constructor() { super("user does not have hydra cloud subscription"); this.name = "UserWithoutCloudSubscriptionError";