mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(server): better api error messages (for unhandled exceptions) (#4817)
* feat(server): better error messages * chore: open api * chore: remove debug log * fix: syntax error * fix: e2e test
This commit is contained in:
parent
d4ef6f52bb
commit
2e424fe249
72 changed files with 1974 additions and 1952 deletions
|
|
@ -32,7 +32,7 @@
|
|||
async function getConfigs() {
|
||||
[savedConfig, defaultConfig] = await Promise.all([
|
||||
api.systemConfigApi.getConfig().then((res) => res.data.ffmpeg),
|
||||
api.systemConfigApi.getDefaults().then((res) => res.data.ffmpeg),
|
||||
api.systemConfigApi.getConfigDefaults().then((res) => res.data.ffmpeg),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
const { data: configs } = await api.systemConfigApi.getDefaults();
|
||||
const { data: configs } = await api.systemConfigApi.getConfigDefaults();
|
||||
|
||||
ffmpegConfig = { ...configs.ffmpeg };
|
||||
defaultConfig = { ...configs.ffmpeg };
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
async function getConfigs() {
|
||||
[savedConfig, defaultConfig] = await Promise.all([
|
||||
api.systemConfigApi.getConfig().then((res) => res.data.job),
|
||||
api.systemConfigApi.getDefaults().then((res) => res.data.job),
|
||||
api.systemConfigApi.getConfigDefaults().then((res) => res.data.job),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
const { data: configs } = await api.systemConfigApi.getDefaults();
|
||||
const { data: configs } = await api.systemConfigApi.getConfigDefaults();
|
||||
|
||||
jobConfig = { ...configs.job };
|
||||
defaultConfig = { ...configs.job };
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
async function getConfigs() {
|
||||
[savedConfig, defaultConfig] = await Promise.all([
|
||||
api.systemConfigApi.getConfig().then((res) => res.data.library),
|
||||
api.systemConfigApi.getDefaults().then((res) => res.data.library),
|
||||
api.systemConfigApi.getConfigDefaults().then((res) => res.data.library),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
const { data: configs } = await api.systemConfigApi.getDefaults();
|
||||
const { data: configs } = await api.systemConfigApi.getConfigDefaults();
|
||||
|
||||
libraryConfig = { ...configs.library };
|
||||
defaultConfig = { ...configs.library };
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
async function refreshConfig() {
|
||||
[savedConfig, defaultConfig] = await Promise.all([
|
||||
api.systemConfigApi.getConfig().then((res) => res.data.machineLearning),
|
||||
api.systemConfigApi.getDefaults().then((res) => res.data.machineLearning),
|
||||
api.systemConfigApi.getConfigDefaults().then((res) => res.data.machineLearning),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
async function refreshConfig() {
|
||||
[savedConfig, defaultConfig] = await Promise.all([
|
||||
api.systemConfigApi.getConfig().then((res) => res.data),
|
||||
api.systemConfigApi.getDefaults().then((res) => res.data),
|
||||
api.systemConfigApi.getConfigDefaults().then((res) => res.data),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
const { data: configs } = await api.systemConfigApi.getDefaults();
|
||||
const { data: configs } = await api.systemConfigApi.getConfigDefaults();
|
||||
|
||||
config = cloneDeep(configs);
|
||||
defaultConfig = cloneDeep(configs);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
async function getConfigs() {
|
||||
[savedConfig, defaultConfig] = await Promise.all([
|
||||
api.systemConfigApi.getConfig().then((res) => res.data.newVersionCheck),
|
||||
api.systemConfigApi.getDefaults().then((res) => res.data.newVersionCheck),
|
||||
api.systemConfigApi.getConfigDefaults().then((res) => res.data.newVersionCheck),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
const { data: configs } = await api.systemConfigApi.getDefaults();
|
||||
const { data: configs } = await api.systemConfigApi.getConfigDefaults();
|
||||
|
||||
newVersionCheckConfig = { ...configs.newVersionCheck };
|
||||
defaultConfig = { ...configs.newVersionCheck };
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
async function getConfigs() {
|
||||
[savedConfig, defaultConfig] = await Promise.all([
|
||||
api.systemConfigApi.getConfig().then((res) => res.data.oauth),
|
||||
api.systemConfigApi.getDefaults().then((res) => res.data.oauth),
|
||||
api.systemConfigApi.getConfigDefaults().then((res) => res.data.oauth),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
const { data: defaultConfig } = await api.systemConfigApi.getDefaults();
|
||||
const { data: defaultConfig } = await api.systemConfigApi.getConfigDefaults();
|
||||
|
||||
oauthConfig = { ...defaultConfig.oauth };
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
async function getConfigs() {
|
||||
[savedConfig, defaultConfig] = await Promise.all([
|
||||
api.systemConfigApi.getConfig().then((res) => res.data.passwordLogin),
|
||||
api.systemConfigApi.getDefaults().then((res) => res.data.passwordLogin),
|
||||
api.systemConfigApi.getConfigDefaults().then((res) => res.data.passwordLogin),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
const { data: configs } = await api.systemConfigApi.getDefaults();
|
||||
const { data: configs } = await api.systemConfigApi.getConfigDefaults();
|
||||
|
||||
passwordLoginConfig = { ...configs.passwordLogin };
|
||||
defaultConfig = { ...configs.passwordLogin };
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
async function getConfigs() {
|
||||
[savedConfig, defaultConfig, templateOptions] = await Promise.all([
|
||||
api.systemConfigApi.getConfig().then((res) => res.data.storageTemplate),
|
||||
api.systemConfigApi.getDefaults().then((res) => res.data.storageTemplate),
|
||||
api.systemConfigApi.getConfigDefaults().then((res) => res.data.storageTemplate),
|
||||
api.systemConfigApi.getStorageTemplateOptions().then((res) => res.data),
|
||||
]);
|
||||
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
const { data: defaultConfig } = await api.systemConfigApi.getDefaults();
|
||||
const { data: defaultConfig } = await api.systemConfigApi.getConfigDefaults();
|
||||
|
||||
storageConfig.template = defaultConfig.storageTemplate.template;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
async function getConfigs() {
|
||||
[savedConfig, defaultConfig] = await Promise.all([
|
||||
api.systemConfigApi.getConfig().then((res) => res.data.theme),
|
||||
api.systemConfigApi.getDefaults().then((res) => res.data.theme),
|
||||
api.systemConfigApi.getConfigDefaults().then((res) => res.data.theme),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
const { data: configs } = await api.systemConfigApi.getDefaults();
|
||||
const { data: configs } = await api.systemConfigApi.getConfigDefaults();
|
||||
|
||||
themeConfig = { ...configs.theme };
|
||||
defaultConfig = { ...configs.theme };
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
async function getConfigs() {
|
||||
[savedConfig, defaultConfig] = await Promise.all([
|
||||
api.systemConfigApi.getConfig().then((res) => res.data.thumbnail),
|
||||
api.systemConfigApi.getDefaults().then((res) => res.data.thumbnail),
|
||||
api.systemConfigApi.getConfigDefaults().then((res) => res.data.thumbnail),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
const { data: configs } = await api.systemConfigApi.getDefaults();
|
||||
const { data: configs } = await api.systemConfigApi.getConfigDefaults();
|
||||
|
||||
thumbnailConfig = { ...configs.thumbnail };
|
||||
defaultConfig = { ...configs.thumbnail };
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
async function getConfigs() {
|
||||
[savedConfig, defaultConfig] = await Promise.all([
|
||||
api.systemConfigApi.getConfig().then((res) => res.data.trash),
|
||||
api.systemConfigApi.getDefaults().then((res) => res.data.trash),
|
||||
api.systemConfigApi.getConfigDefaults().then((res) => res.data.trash),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
const { data: configs } = await api.systemConfigApi.getDefaults();
|
||||
const { data: configs } = await api.systemConfigApi.getConfigDefaults();
|
||||
|
||||
trashConfig = { ...configs.trash };
|
||||
defaultConfig = { ...configs.trash };
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
const firstName = form.get('firstName');
|
||||
const lastName = form.get('lastName');
|
||||
|
||||
const { status } = await api.authenticationApi.adminSignUp({
|
||||
const { status } = await api.authenticationApi.signUpAdmin({
|
||||
signUpDto: {
|
||||
email: String(email),
|
||||
password: String(password),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import { page } from '$app/stores';
|
||||
import { locale, sidebarSettings } from '$lib/stores/preferences.store';
|
||||
import { featureFlags } from '$lib/stores/server-config.store';
|
||||
import { AssetApiGetAssetStatsRequest, api } from '@api';
|
||||
import { AssetApiGetAssetStatisticsRequest, api } from '@api';
|
||||
import {
|
||||
mdiAccount,
|
||||
mdiAccountMultiple,
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
import SideBarButton from './side-bar-button.svelte';
|
||||
import SideBarSection from './side-bar-section.svelte';
|
||||
|
||||
const getStats = async (dto: AssetApiGetAssetStatsRequest) => {
|
||||
const { data: stats } = await api.assetApi.getAssetStats(dto);
|
||||
const getStats = async (dto: AssetApiGetAssetStatisticsRequest) => {
|
||||
const { data: stats } = await api.assetApi.getAssetStatistics(dto);
|
||||
return stats;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@
|
|||
};
|
||||
|
||||
async function readLibraryList() {
|
||||
const { data } = await api.libraryApi.getAllForUser();
|
||||
const { data } = await api.libraryApi.getLibraries();
|
||||
libraries = data;
|
||||
|
||||
dropdownOpen.length = libraries.length;
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@
|
|||
};
|
||||
|
||||
async function refreshKeys() {
|
||||
const { data } = await api.keyApi.getKeys();
|
||||
const { data } = await api.keyApi.getApiKeys();
|
||||
keys = data;
|
||||
}
|
||||
|
||||
const handleCreate = async (event: CustomEvent<APIKeyResponseDto>) => {
|
||||
try {
|
||||
const dto = event.detail;
|
||||
const { data } = await api.keyApi.createKey({ aPIKeyCreateDto: dto });
|
||||
const { data } = await api.keyApi.createApiKey({ aPIKeyCreateDto: dto });
|
||||
secret = data.secret;
|
||||
} catch (error) {
|
||||
handleError(error, 'Unable to create a new API Key');
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
const dto = event.detail;
|
||||
|
||||
try {
|
||||
await api.keyApi.updateKey({ id: editKey.id, aPIKeyUpdateDto: { name: dto.name } });
|
||||
await api.keyApi.updateApiKey({ id: editKey.id, aPIKeyUpdateDto: { name: dto.name } });
|
||||
notificationController.show({
|
||||
message: `Saved API Key`,
|
||||
type: NotificationType.Info,
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
}
|
||||
|
||||
try {
|
||||
await api.keyApi.deleteKey({ id: deleteKey.id });
|
||||
await api.keyApi.deleteApiKey({ id: deleteKey.id });
|
||||
notificationController.show({
|
||||
message: `Removed API Key: ${deleteKey.name}`,
|
||||
type: NotificationType.Info,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue