mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-18 16:53:57 +00:00
feat: handle and log game backup errors
This commit is contained in:
@@ -219,6 +219,7 @@
|
||||
"uploading_backup": "Uploading backup…",
|
||||
"no_backups": "You haven't created any backups for this game yet",
|
||||
"backup_uploaded": "Backup uploaded",
|
||||
"backup_failed": "Backup failed",
|
||||
"backup_deleted": "Backup deleted",
|
||||
"backup_restored": "Backup restored",
|
||||
"see_all_achievements": "See all achievements",
|
||||
|
||||
@@ -204,6 +204,7 @@
|
||||
"uploading_backup": "Subiendo copia de seguridad…",
|
||||
"no_backups": "No has creado ninguna copia de seguridad para este juego todavía",
|
||||
"backup_uploaded": "Copia de seguridad subida",
|
||||
"backup_failed": "Copia de seguridad fallida",
|
||||
"backup_deleted": "Copia de seguridad eliminada",
|
||||
"backup_restored": "Copia de seguridad restaurada",
|
||||
"see_all_achievements": "Ver todos los logros",
|
||||
|
||||
@@ -142,6 +142,7 @@
|
||||
"uploading_backup": "A criar backup…",
|
||||
"no_backups": "Ainda não fizeste nenhum backup deste jogo",
|
||||
"backup_uploaded": "Backup criado",
|
||||
"backup_failed": "Falha ao criar backup",
|
||||
"backup_deleted": "Backup apagado",
|
||||
"backup_restored": "Backup restaurado",
|
||||
"see_all_achievements": "Ver todas as conquistas",
|
||||
|
||||
@@ -76,7 +76,11 @@ export const getSteamAppDetails = async (
|
||||
return null;
|
||||
})
|
||||
.catch((err) => {
|
||||
logger.error(err, { method: "getSteamAppDetails" });
|
||||
logger.error("Error on getSteamAppDetails", {
|
||||
message: err?.message,
|
||||
code: err?.code,
|
||||
name: err?.name,
|
||||
});
|
||||
return null;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -33,9 +33,18 @@ export function ConfirmModal({
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal visible={visible} title={title} description={description} onClose={onClose}>
|
||||
<Modal
|
||||
visible={visible}
|
||||
title={title}
|
||||
description={description}
|
||||
onClose={onClose}
|
||||
>
|
||||
<div className="confirm-modal__actions">
|
||||
<Button onClick={handleConfirm} theme={confirmTheme} disabled={confirmDisabled}>
|
||||
<Button
|
||||
onClick={handleConfirm}
|
||||
theme={confirmTheme}
|
||||
disabled={confirmDisabled}
|
||||
>
|
||||
{confirmLabel || t("confirm")}
|
||||
</Button>
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ export function CloudSyncContextProvider({
|
||||
const [loadingPreview, setLoadingPreview] = useState(false);
|
||||
const [freezingArtifact, setFreezingArtifact] = useState(false);
|
||||
|
||||
const { showSuccessToast } = useToast();
|
||||
const { showSuccessToast, showErrorToast } = useToast();
|
||||
|
||||
const downloadGameArtifact = useCallback(
|
||||
async (gameArtifactId: string) => {
|
||||
@@ -122,9 +122,15 @@ export function CloudSyncContextProvider({
|
||||
const uploadSaveGame = useCallback(
|
||||
async (downloadOptionTitle: string | null) => {
|
||||
setUploadingBackup(true);
|
||||
window.electron.uploadSaveGame(objectId, shop, downloadOptionTitle);
|
||||
window.electron
|
||||
.uploadSaveGame(objectId, shop, downloadOptionTitle)
|
||||
.catch((err) => {
|
||||
setUploadingBackup(false);
|
||||
logger.error("Failed to upload save game", { objectId, shop, err });
|
||||
showErrorToast(t("backup_failed"));
|
||||
});
|
||||
},
|
||||
[objectId, shop]
|
||||
[objectId, shop, t, showErrorToast]
|
||||
);
|
||||
|
||||
const toggleArtifactFreeze = useCallback(
|
||||
|
||||
@@ -201,7 +201,8 @@ export function GameDetailsContextProvider({
|
||||
}, [objectId, gameTitle, dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
const state = (location && (location.state as Record<string, unknown>)) || {};
|
||||
const state =
|
||||
(location && (location.state as Record<string, unknown>)) || {};
|
||||
if (state.openRepacks) {
|
||||
setShowRepacksModal(true);
|
||||
try {
|
||||
|
||||
@@ -69,14 +69,32 @@ export function HeroPanelActions() {
|
||||
updateGame();
|
||||
};
|
||||
|
||||
window.addEventListener("hydra:game-favorite-toggled", onFavoriteToggled as EventListener);
|
||||
window.addEventListener("hydra:game-removed-from-library", onGameRemoved as EventListener);
|
||||
window.addEventListener("hydra:game-files-removed", onFilesRemoved as EventListener);
|
||||
window.addEventListener(
|
||||
"hydra:game-favorite-toggled",
|
||||
onFavoriteToggled as EventListener
|
||||
);
|
||||
window.addEventListener(
|
||||
"hydra:game-removed-from-library",
|
||||
onGameRemoved as EventListener
|
||||
);
|
||||
window.addEventListener(
|
||||
"hydra:game-files-removed",
|
||||
onFilesRemoved as EventListener
|
||||
);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("hydra:game-favorite-toggled", onFavoriteToggled as EventListener);
|
||||
window.removeEventListener("hydra:game-removed-from-library", onGameRemoved as EventListener);
|
||||
window.removeEventListener("hydra:game-files-removed", onFilesRemoved as EventListener);
|
||||
window.removeEventListener(
|
||||
"hydra:game-favorite-toggled",
|
||||
onFavoriteToggled as EventListener
|
||||
);
|
||||
window.removeEventListener(
|
||||
"hydra:game-removed-from-library",
|
||||
onGameRemoved as EventListener
|
||||
);
|
||||
window.removeEventListener(
|
||||
"hydra:game-files-removed",
|
||||
onFilesRemoved as EventListener
|
||||
);
|
||||
};
|
||||
}, [updateLibrary, updateGame]);
|
||||
|
||||
@@ -226,7 +244,7 @@ export function HeroPanelActions() {
|
||||
onClick={() => setShowRepacksModal(true)}
|
||||
theme="outline"
|
||||
disabled={isGameDownloading}
|
||||
className={`hero-panel-actions__action ${!repacks.length ? 'hero-panel-actions__action--disabled' : ''}`}
|
||||
className={`hero-panel-actions__action ${!repacks.length ? "hero-panel-actions__action--disabled" : ""}`}
|
||||
>
|
||||
<DownloadIcon />
|
||||
{t("download")}
|
||||
|
||||
@@ -277,4 +277,4 @@ export function RepacksModal({
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user