forked from lugvitc/FOSSit24
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request lugvitc#16 from KreativeThinker/main
Error messages and Error Notifications
- Loading branch information
Showing
10 changed files
with
139 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%sveltekit.assets%/logo.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
%sveltekit.head% | ||
</head> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%sveltekit.assets%/logo.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
%sveltekit.head% | ||
</head> | ||
|
||
<body data-sveltekit-preload-data="hover" class="bg-black text-foreground"> | ||
<div style="display: contents">%sveltekit.body%</div> | ||
</body> | ||
|
||
<body data-sveltekit-preload-data="hover" class="bg-black text-foreground"> | ||
<div style="display: contents">%sveltekit.body%</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { createClient } from "@supabase/supabase-js"; | ||
import { createClient } from '@supabase/supabase-js'; | ||
|
||
const PROJECT_URL = "https://snytdulgbjatdmtotpmk.supabase.co"; | ||
const PROJECT_URL = 'https://snytdulgbjatdmtotpmk.supabase.co'; | ||
const ANON_KEY = | ||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNueXRkdWxnYmphdGRtdG90cG1rIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDk5NzcwOTksImV4cCI6MjAyNTU1MzA5OX0.gBKmnpJAqnxkPHx9ARvbJLXmorcBwmdIRbkuNduebAM"; | ||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNueXRkdWxnYmphdGRtdG90cG1rIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDk5NzcwOTksImV4cCI6MjAyNTU1MzA5OX0.gBKmnpJAqnxkPHx9ARvbJLXmorcBwmdIRbkuNduebAM'; | ||
|
||
const supabase = createClient(PROJECT_URL, ANON_KEY); | ||
export default supabase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,56 @@ | ||
<script> | ||
<script lang="ts"> | ||
import '../app.css'; | ||
import { base } from '$app/paths'; | ||
import Navbar from '$lib/components/Navbar.svelte'; | ||
import { onMount } from 'svelte'; | ||
import Glass from '$lib/components/Glass.svelte'; | ||
import { slide } from 'svelte/transition'; | ||
let showError: boolean = false; | ||
let errorMessage: string; | ||
async function handleError(event: ErrorEvent) { | ||
const error = event.error; | ||
errorMessage = error ? error.message : 'Unknown Error: Find it and Fix it!'; | ||
showError = true; | ||
console.log(errorMessage); | ||
} | ||
// onerror = (e) => { | ||
// console.log('error', 'Error: ' + e); | ||
// }; | ||
onMount(() => { | ||
onunhandledrejection = (e) => { | ||
console.log(e.reason.message); | ||
console.log = (e) => { | ||
errorMessage = e; | ||
showError = true; | ||
setTimeout(() => { | ||
showError = false; | ||
}, 2000); | ||
}; | ||
console.error = (e) => { | ||
errorMessage = e; | ||
showError = true; | ||
setTimeout(() => { | ||
showError = false; | ||
}, 2000); | ||
}; | ||
}); | ||
</script> | ||
|
||
<svelte:head> | ||
<link rel="stylesheet" href="{base}/assets/robit/font.css" /> | ||
</svelte:head> | ||
<svelte:window | ||
on:error={() => { | ||
handleError; | ||
}} | ||
/> | ||
|
||
<Navbar></Navbar> | ||
<slot /> | ||
|
||
{#if showError} | ||
<div | ||
class="fixed right-5 top-5 z-[1000] mx-5 w-fit rounded-3xl bg-negative p-4 text-background md:w-72" | ||
transition:slide | ||
> | ||
<p class="text-sm text-background">{errorMessage}</p> | ||
</div> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters