Compare commits

...

8 commits

Author SHA1 Message Date
ac97696c6a Do not show error instead show undefined value
All checks were successful
ci/woodpecker/push/build Pipeline was successful
2023-12-22 12:44:37 +01:00
a37f8a3f29 Add handler for client and server errors 2023-12-22 12:44:08 +01:00
fbad879acb Better error message page 2023-12-22 12:43:48 +01:00
eac85ec934 Same as before 2023-12-22 12:38:49 +01:00
eb69f00c26 Use sveltekit fetch 2023-12-22 12:38:44 +01:00
9d940a29c3 Add sentry config 2023-12-22 12:34:18 +01:00
5e23f48937 Add error mage 2023-12-22 12:30:07 +01:00
03ff5947fc Do not error out but show undefined value 2023-12-22 12:29:55 +01:00
8 changed files with 1030 additions and 118 deletions

File diff suppressed because it is too large Load diff

View file

@ -32,6 +32,7 @@
}, },
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@sentry/sveltekit": "^7.90.0",
"leaflet": "^1.9.4", "leaflet": "^1.9.4",
"leaflet-gpx": "^1.7.0", "leaflet-gpx": "^1.7.0",
"svelte-preprocess": "^5.1.3" "svelte-preprocess": "^5.1.3"

41
frontend/src/error.html Normal file
View file

@ -0,0 +1,41 @@
<html>
<head>
<style>
* {
box-sizing: border-box;
}
body {
background-image: url(/splash.webp);
background-size: cover;
display: grid;
place-content: center;
height: 100%;
font-size: 24px;
font-family: monospace;
}
.wrapper {
display: flex;
backdrop-filter: blur(5px);
border-radius: 10px;
border: 1px solid black;
}
#status {
border-right: 1px solid black;
}
p {
padding: 20px;
}
</style>
</head>
<body>
<div class="wrapper">
<p id="status">Code %sveltekit.status%</p>
<p id="message">%sveltekit.error.message%</p>
</div>
</body>
</html>

View file

@ -0,0 +1,5 @@
export async function handleError({ error, event, status, message }) {
return {
message
};
}

View file

@ -1,4 +1,10 @@
export async function handle({ event, resolve }) { export async function handle({ event, resolve }) {
const response = await resolve(event); const response = await resolve(event);
return response; return response;
}
export async function handleError({ error, event, status, message }) {
return {
message
};
} }

View file

@ -5,12 +5,12 @@
<div id="grid"> <div id="grid">
<div> <div>
<p>Distanza</p> <p>Distanza</p>
<p>{route.route_sport_details[1].distance} m</p> <p>{route?.route_sport_details[1]?.distance} m</p>
</div> </div>
<div> <div>
<p>Dislivello Positivo</p> <p>Dislivello Positivo</p>
<p>{route.route_sport_details[1].elevation_gain}</p> <p>{route?.route_sport_details[1]?.elevation_gain}</p>
</div> </div>
<div> <div>
@ -20,32 +20,32 @@
<div> <div>
<p>Difficolta</p> <p>Difficolta</p>
<p>{route.route_sport_details[1].difficulty_it}</p> <p>{route?.route_sport_details[1]?.difficulty_it}</p>
</div> </div>
<div> <div>
<p>Dislivello Negativo</p> <p>Dislivello Negativo</p>
<p>{route.route_sport_details[1].elevation_loss}</p> <p>{route?.route_sport_details[1]?.elevation_loss}</p>
</div> </div>
<div> <div>
<p>Durata</p> <p>Durata</p>
<p>{route.route_sport_details[1].duration}'</p> <p>{route?.route_sport_details[1]?.duration}'</p>
</div> </div>
<div> <div>
<p>Altitudine max</p> <p>Altitudine max</p>
<p>{route.route_sport_details[1].altitude_max}</p> <p>{route?.route_sport_details[1]?.altitude_max}</p>
</div> </div>
<div> <div>
<p>Altitudine min</p> <p>Altitudine min</p>
<p>{route.route_sport_details[1].altitude_min}</p> <p>{route?.route_sport_details[1]?.altitude_min}</p>
</div> </div>
<div> <div>
<p>Tipo Percorso</p> <p>Tipo Percorso</p>
<p>{route.route_sport_details[1].route_type_it}</p> <p>{route?.route_sport_details[1]?.route_type_it}</p>
</div> </div>
</div> </div>

View file

@ -5,12 +5,12 @@
<div id="grid"> <div id="grid">
<div> <div>
<p>Distanza</p> <p>Distanza</p>
<p>{route.route_sport_details[0].distance} m</p> <p>{route?.route_sport_details[0]?.distance} m</p>
</div> </div>
<div> <div>
<p>Dislivello Positivo</p> <p>Dislivello Positivo</p>
<p>{route.route_sport_details[0].elevation_gain}</p> <p>{route?.route_sport_details[0]?.elevation_gain}</p>
</div> </div>
<div> <div>
@ -20,32 +20,32 @@
<div> <div>
<p>Difficolta</p> <p>Difficolta</p>
<p>{route.route_sport_details[0].difficulty_it}</p> <p>{route?.route_sport_details[0]?.difficulty_it}</p>
</div> </div>
<div> <div>
<p>Dislivello Negativo</p> <p>Dislivello Negativo</p>
<p>{route.route_sport_details[0].elevation_loss}</p> <p>{route?.route_sport_details[0]?.elevation_loss}</p>
</div> </div>
<div> <div>
<p>Durata</p> <p>Durata</p>
<p>{route.route_sport_details[0].duration}'</p> <p>{route?.route_sport_details[0]?.duration}'</p>
</div> </div>
<div> <div>
<p>Altitudine max</p> <p>Altitudine max</p>
<p>{route.route_sport_details[0].altitude_max}</p> <p>{route?.route_sport_details[0]?.altitude_max}</p>
</div> </div>
<div> <div>
<p>Altitudine min</p> <p>Altitudine min</p>
<p>{route.route_sport_details[0].altitude_min}</p> <p>{route?.route_sport_details[0]?.altitude_min}</p>
</div> </div>
<div> <div>
<p>Tipo Percorso</p> <p>Tipo Percorso</p>
<p>{route.route_sport_details[0].route_type_it}</p> <p>{route?.route_sport_details[0]?.route_type_it}</p>
</div> </div>
</div> </div>

View file

@ -1,3 +1,11 @@
export const prerender = false; export const prerender = false;
export const ssr = true; export const ssr = true;
export const csr = true; export const csr = true;
/**
* This is a global configuration for using sveltekit
* custom 'fetch' function that enables a lot of things
*/
export async function load({ fetch }) {
window.fetch = fetch;
}