Added error handling notification (#536)

This commit is contained in:
Alex
2022-08-26 10:36:41 -07:00
committed by GitHub
parent 33b810de74
commit 4be9aa091b
10 changed files with 118 additions and 26 deletions

View File

@@ -10,6 +10,10 @@
import NavigationBar from '$lib/components/shared-components/navigation-bar.svelte';
import SideBar from '$lib/components/shared-components/side-bar/side-bar.svelte';
import PlusBoxOutline from 'svelte-material-icons/PlusBoxOutline.svelte';
import {
notificationController,
NotificationType
} from '$lib/components/shared-components/notification/notification';
export let data: PageData;
@@ -40,7 +44,11 @@
goto('/albums/' + newAlbum.id);
} catch (e) {
console.log('Error [createAlbum] ', e);
console.error('Error [createAlbum] ', e);
notificationController.show({
message: 'Error creating album, check console for more details',
type: NotificationType.Error
});
}
};
@@ -49,7 +57,7 @@
await api.albumApi.deleteAlbum(album.id);
return true;
} catch (e) {
console.log('Error [autoDeleteAlbum] ', e);
console.error('Error [autoDeleteAlbum] ', e);
return false;
}
};
@@ -64,7 +72,11 @@
await api.albumApi.deleteAlbum(targetAlbum.id);
data.albums = data.albums.filter((a) => a.id !== targetAlbum.id);
} catch (e) {
console.log('Error [userDeleteMenu] ', e);
console.error('Error [userDeleteMenu] ', e);
notificationController.show({
message: 'Error deleting user, check console for more details',
type: NotificationType.Error
});
}
}

View File

@@ -21,6 +21,10 @@
import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte';
import type { PageData } from './$types';
import { onMount } from 'svelte';
import {
notificationController,
NotificationType
} from '$lib/components/shared-components/notification/notification';
export let data: PageData;
@@ -68,7 +72,10 @@
pushState(selectedAsset.id);
}
} catch (e) {
console.log('Error navigating asset forward', e);
notificationController.show({
type: NotificationType.Info,
message: 'You have reached the end'
});
}
};
@@ -80,7 +87,10 @@
pushState(selectedAsset.id);
}
} catch (e) {
console.log('Error navigating asset backward', e);
notificationController.show({
type: NotificationType.Info,
message: 'You have reached the end'
});
}
};
@@ -176,7 +186,11 @@
clearMultiSelectAssetAssetHandler();
}
} catch (e) {
console.log('Error deleteSelectedAssetHandler', e);
notificationController.show({
type: NotificationType.Error,
message: 'Error deleting assets, check console for more details'
});
console.error('Error deleteSelectedAssetHandler', e);
}
};
</script>

View File

@@ -6,6 +6,10 @@
import { goto } from '$app/navigation';
import { api } from '@api';
import type { PageData } from './$types';
import {
notificationController,
NotificationType
} from '$lib/components/shared-components/notification/notification';
export let data: PageData;
@@ -17,6 +21,11 @@
goto('/albums/' + newAlbum.id);
} catch (e) {
notificationController.show({
message: 'Error creating album, check console for more details',
type: NotificationType.Error
});
console.log('Error [createAlbum] ', e);
}
};