mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
feat: update error log
This commit is contained in:
parent
df5f82d47f
commit
6ef1135ba2
@ -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,
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user