Improve error messages
This improves error messages throughout. It might sometimes be too verbose, but that's better than being opaque (#74). Also upgrades Deno's patch version. Fixes #74
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
FROM denoland/deno:ubuntu-2.3.5
|
FROM denoland/deno:ubuntu-2.3.6
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|||||||
@@ -165,10 +165,15 @@ export default function MainExpenses({ initialBudgets, initialExpenses, initialM
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to export expenses. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as ExportResponseBody;
|
const result = await response.json() as ExportResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
throw new Error('Failed to get contact!');
|
throw new Error('Failed to export expenses!');
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportContents = JSON.stringify(result.jsonContents, null, 2);
|
const exportContents = JSON.stringify(result.jsonContents, null, 2);
|
||||||
|
|||||||
@@ -123,6 +123,11 @@ export default function MainFiles(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: requestBody,
|
body: requestBody,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to upload file. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as UploadResponseBody;
|
const result = await response.json() as UploadResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -170,6 +175,11 @@ export default function MainFiles(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to create directory. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as CreateDirectoryResponseBody;
|
const result = await response.json() as CreateDirectoryResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -239,6 +249,11 @@ export default function MainFiles(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to rename directory. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as RenameDirectoryResponseBody;
|
const result = await response.json() as RenameDirectoryResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -273,6 +288,11 @@ export default function MainFiles(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to rename file. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as RenameResponseBody;
|
const result = await response.json() as RenameResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -327,6 +347,11 @@ export default function MainFiles(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to move directory. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as MoveDirectoryResponseBody;
|
const result = await response.json() as MoveDirectoryResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -359,6 +384,11 @@ export default function MainFiles(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to move file. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as MoveResponseBody;
|
const result = await response.json() as MoveResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -391,6 +421,11 @@ export default function MainFiles(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to delete directory. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as DeleteDirectoryResponseBody;
|
const result = await response.json() as DeleteDirectoryResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -423,6 +458,11 @@ export default function MainFiles(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to delete file. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as DeleteResponseBody;
|
const result = await response.json() as DeleteResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -536,6 +576,11 @@ export default function MainFiles(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to create share. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as CreateShareResponseBody;
|
const result = await response.json() as CreateShareResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -587,6 +632,11 @@ export default function MainFiles(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to update share. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as UpdateShareResponseBody;
|
const result = await response.json() as UpdateShareResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -624,6 +674,11 @@ export default function MainFiles(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to delete file share. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as DeleteShareResponseBody;
|
const result = await response.json() as DeleteShareResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ export default function ManageShareModal(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to get file share. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as ResponseBody;
|
const result = await response.json() as ResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
@@ -42,6 +42,11 @@ export default function MoveDirectoryOrFileModal(
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to get directories. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as ResponseBody;
|
const result = await response.json() as ResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ export default function SearchFiles({}: SearchFilesProps) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to search files. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as ResponseBody;
|
const result = await response.json() as ResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
@@ -64,6 +64,11 @@ export default function MainNotes({ initialDirectories, initialFiles, initialPat
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: requestBody,
|
body: requestBody,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to create note. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as UploadResponseBody;
|
const result = await response.json() as UploadResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -114,6 +119,11 @@ export default function MainNotes({ initialDirectories, initialFiles, initialPat
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to create directory. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as CreateDirectoryResponseBody;
|
const result = await response.json() as CreateDirectoryResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -155,6 +165,11 @@ export default function MainNotes({ initialDirectories, initialFiles, initialPat
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to delete directory. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as DeleteDirectoryResponseBody;
|
const result = await response.json() as DeleteDirectoryResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -187,6 +202,11 @@ export default function MainNotes({ initialDirectories, initialFiles, initialPat
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to delete note. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as DeleteResponseBody;
|
const result = await response.json() as DeleteResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ export default function MainPhotos({ initialDirectories, initialFiles, initialPa
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: requestBody,
|
body: requestBody,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to upload photo. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as UploadResponseBody;
|
const result = await response.json() as UploadResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -104,6 +109,11 @@ export default function MainPhotos({ initialDirectories, initialFiles, initialPa
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to create directory. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as CreateDirectoryResponseBody;
|
const result = await response.json() as CreateDirectoryResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
website:
|
website:
|
||||||
image: ghcr.io/bewcloud/bewcloud:v2.2.0
|
image: ghcr.io/bewcloud/bewcloud:v2.2.2
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 127.0.0.1:8000:8000
|
- 127.0.0.1:8000:8000
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export default function MultiFactorAuthSettings({ methods }: MultiFactorAuthSett
|
|||||||
const beginData = await beginResponse.json() as PasskeySetupBeginResponseBody;
|
const beginData = await beginResponse.json() as PasskeySetupBeginResponseBody;
|
||||||
|
|
||||||
if (!beginData.success) {
|
if (!beginData.success) {
|
||||||
throw new Error(beginData.error || 'Failed to begin passkey registration');
|
throw new Error(beginData.error || 'Failed to begin passkey registration.');
|
||||||
}
|
}
|
||||||
|
|
||||||
const registrationResponse = await startRegistration({ optionsJSON: beginData.options! });
|
const registrationResponse = await startRegistration({ optionsJSON: beginData.options! });
|
||||||
@@ -125,7 +125,7 @@ export default function MultiFactorAuthSettings({ methods }: MultiFactorAuthSett
|
|||||||
const completeData = await completeResponse.json() as PasskeySetupCompleteResponseBody;
|
const completeData = await completeResponse.json() as PasskeySetupCompleteResponseBody;
|
||||||
|
|
||||||
if (!completeData.success) {
|
if (!completeData.success) {
|
||||||
throw new Error(completeData.error || 'Failed to complete passkey registration');
|
throw new Error(completeData.error || 'Failed to complete passkey registration.');
|
||||||
}
|
}
|
||||||
|
|
||||||
setupData.value = {
|
setupData.value = {
|
||||||
@@ -142,10 +142,16 @@ export default function MultiFactorAuthSettings({ methods }: MultiFactorAuthSett
|
|||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(
|
||||||
|
`Failed to setup TOTP multi-factor authentication. ${response.statusText} ${await response.text()}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const data = await response.json() as TOTPSetupResponseBody;
|
const data = await response.json() as TOTPSetupResponseBody;
|
||||||
|
|
||||||
if (!data.success || !data.data) {
|
if (!data.success || !data.data) {
|
||||||
throw new Error(data.error || 'Failed to setup TOTP multi-factor authentication');
|
throw new Error(data.error || 'Failed to setup TOTP multi-factor authentication.');
|
||||||
}
|
}
|
||||||
|
|
||||||
setupData.value = {
|
setupData.value = {
|
||||||
@@ -165,10 +171,17 @@ export default function MultiFactorAuthSettings({ methods }: MultiFactorAuthSett
|
|||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(
|
||||||
|
`Failed to setup email multi-factor authentication. Please check your SMTP settings are valid and try again. ${response.statusText} ${await response
|
||||||
|
.text()}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const data = await response.json() as EmailSetupResponseBody;
|
const data = await response.json() as EmailSetupResponseBody;
|
||||||
|
|
||||||
if (!data.success || !data.data) {
|
if (!data.success || !data.data) {
|
||||||
throw new Error(data.error || 'Failed to setup email multi-factor authentication');
|
throw new Error(data.error || 'Failed to setup email multi-factor authentication.');
|
||||||
}
|
}
|
||||||
|
|
||||||
setupData.value = {
|
setupData.value = {
|
||||||
@@ -221,13 +234,19 @@ export default function MultiFactorAuthSettings({ methods }: MultiFactorAuthSett
|
|||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(
|
||||||
|
`Failed to enable multi-factor authentication method. ${response.statusText} ${await response.text()}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const data = await response.json() as MultiFactorAuthEnableResponseBody;
|
const data = await response.json() as MultiFactorAuthEnableResponseBody;
|
||||||
|
|
||||||
if (!data.success) {
|
if (!data.success) {
|
||||||
throw new Error(data.error || 'Failed to enable multi-factor authentication');
|
throw new Error(data.error || 'Failed to enable multi-factor authentication method.');
|
||||||
}
|
}
|
||||||
|
|
||||||
success.value = 'Multi-factor authentication has been enabled successfully! Reloading...';
|
success.value = 'Multi-factor authentication method has been enabled successfully! Reloading...';
|
||||||
setupData.value = null;
|
setupData.value = null;
|
||||||
verificationToken.value = '';
|
verificationToken.value = '';
|
||||||
|
|
||||||
@@ -262,13 +281,19 @@ export default function MultiFactorAuthSettings({ methods }: MultiFactorAuthSett
|
|||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(
|
||||||
|
`Failed to disable multi-factor authentication method. ${response.statusText} ${await response.text()}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const data = await response.json() as MultiFactorAuthDisableResponseBody;
|
const data = await response.json() as MultiFactorAuthDisableResponseBody;
|
||||||
|
|
||||||
if (!data.success) {
|
if (!data.success) {
|
||||||
throw new Error(data.error || 'Failed to disable multi-factor authentication');
|
throw new Error(data.error || 'Failed to disable multi-factor authentication method.');
|
||||||
}
|
}
|
||||||
|
|
||||||
success.value = 'Multi-factor authentication has been disabled successfully! Reloading...';
|
success.value = 'Multi-factor authentication method has been disabled successfully! Reloading...';
|
||||||
showDisableForm.value = null;
|
showDisableForm.value = null;
|
||||||
disablePassword.value = '';
|
disablePassword.value = '';
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,15 @@ export default function Links({ initialLinks }: LinksProps) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to save link. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as ResponseBody;
|
const result = await response.json() as ResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
throw new Error('Failed to save notes!');
|
throw new Error('Failed to save link!');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ export default function Notes({ initialNotes }: NotesProps) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to save notes. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as ResponseBody;
|
const result = await response.json() as ResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ export default function Articles({ initialArticles }: ArticlesProps) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to refresh articles. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as RefreshResponseBody;
|
const result = await response.json() as RefreshResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -87,6 +92,11 @@ export default function Articles({ initialArticles }: ArticlesProps) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to mark article as read. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as ReadResponseBody;
|
const result = await response.json() as ReadResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -114,6 +124,11 @@ export default function Articles({ initialArticles }: ArticlesProps) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to mark all articles as read. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as ReadResponseBody;
|
const result = await response.json() as ReadResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
@@ -84,6 +84,11 @@ export default function Feeds({ initialFeeds }: FeedsProps) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to add feed. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as AddResponseBody;
|
const result = await response.json() as AddResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -116,6 +121,11 @@ export default function Feeds({ initialFeeds }: FeedsProps) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to delete feed. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as DeleteResponseBody;
|
const result = await response.json() as DeleteResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -168,6 +178,11 @@ export default function Feeds({ initialFeeds }: FeedsProps) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to import feeds. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as ImportResponseBody;
|
const result = await response.json() as ImportResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ export default function Note({ fileName, currentPath, contents }: NoteProps) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(requestBody),
|
body: JSON.stringify(requestBody),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to save note. ${response.statusText} ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await response.json() as ResponseBody;
|
const result = await response.json() as ResponseBody;
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user