mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-09 03:37:45 +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 { getUnlockedAchievements } from "@main/events/user/get-unlocked-achievements";
|
||||||
import { Game } from "@main/entity";
|
import { Game } from "@main/entity";
|
||||||
import { achievementsLogger } from "../logger";
|
import { achievementsLogger } from "../logger";
|
||||||
|
import { SubscriptionRequiredError } from "@shared";
|
||||||
|
|
||||||
const saveAchievementsOnLocal = async (
|
const saveAchievementsOnLocal = async (
|
||||||
objectId: string,
|
objectId: string,
|
||||||
@ -141,7 +142,10 @@ export const mergeAchievements = async (
|
|||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
achievementsLogger.error(err);
|
if (err! instanceof SubscriptionRequiredError) {
|
||||||
|
achievementsLogger.error(err);
|
||||||
|
}
|
||||||
|
|
||||||
return saveAchievementsOnLocal(
|
return saveAchievementsOnLocal(
|
||||||
game.objectID,
|
game.objectID,
|
||||||
game.shop,
|
game.shop,
|
||||||
|
@ -8,10 +8,7 @@ import url from "url";
|
|||||||
import { uploadGamesBatch } from "./library-sync";
|
import { uploadGamesBatch } from "./library-sync";
|
||||||
import { clearGamesRemoteIds } from "./library-sync/clear-games-remote-id";
|
import { clearGamesRemoteIds } from "./library-sync/clear-games-remote-id";
|
||||||
import { logger } from "./logger";
|
import { logger } from "./logger";
|
||||||
import {
|
import { UserNotLoggedInError, SubscriptionRequiredError } from "@shared";
|
||||||
UserNotLoggedInError,
|
|
||||||
UserWithoutCloudSubscriptionError,
|
|
||||||
} from "@shared";
|
|
||||||
// import { omit } from "lodash-es";
|
// import { omit } from "lodash-es";
|
||||||
import { appVersion } from "@main/constants";
|
import { appVersion } from "@main/constants";
|
||||||
import { omit } from "lodash-es";
|
import { omit } from "lodash-es";
|
||||||
@ -40,7 +37,6 @@ export class HydraApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static async hasCloudSubscription() {
|
private static async hasCloudSubscription() {
|
||||||
// TODO change this later, this is just a quick test
|
|
||||||
return userSubscriptionRepository
|
return userSubscriptionRepository
|
||||||
.findOne({ where: { id: 1 } })
|
.findOne({ where: { id: 1 } })
|
||||||
.then((userSubscription) => {
|
.then((userSubscription) => {
|
||||||
@ -262,7 +258,7 @@ export class HydraApi {
|
|||||||
|
|
||||||
if (needsCloud) {
|
if (needsCloud) {
|
||||||
if (!(await this.hasCloudSubscription())) {
|
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() {
|
constructor() {
|
||||||
super("user does not have hydra cloud subscription");
|
super("user does not have hydra cloud subscription");
|
||||||
this.name = "UserWithoutCloudSubscriptionError";
|
this.name = "UserWithoutCloudSubscriptionError";
|
||||||
|
Loading…
Reference in New Issue
Block a user