Skip to content

Commit 169e2cd

Browse files
committed
Upgraded svelte
1 parent 00dd39b commit 169e2cd

File tree

5 files changed

+414
-21
lines changed

5 files changed

+414
-21
lines changed

example/svelte-kit/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"svelte": "^5.19.9",
1919
"svelte-check": "^4.1.4",
2020
"typescript": "^5.7.3",
21-
"vite": "^6.1.0"
21+
"vite": "^6.1.0",
22+
"vitest": "^3.0.5"
2223
},
2324
"type": "module",
2425
"publishConfig": {

example/svelte-kit/src/hooks.client.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Exceptionless.startup((c) => {
99
});
1010

1111
/** @type {import('@sveltejs/kit').HandleClientError} */
12-
export async function handleError({ error, event }) {
13-
console.log("client error handler");
14-
await Exceptionless.submitException(toError(error));
12+
export async function handleError({ error, event, message, status }) {
13+
console.warn({ error, event, message, source: 'client error handler', status });
14+
await Exceptionless.createException(toError(error ?? message))
15+
.setProperty('status', status)
16+
.submit();
1517
}

example/svelte-kit/src/routes/+page.svelte

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
<script>
22
import { Exceptionless } from "@exceptionless/browser";
33
4-
let message = null;
5-
let errorInfo = null;
4+
let message = $state("");
5+
let errorInfo = $state("");
66
77
async function submitMessage() {
88
await Exceptionless.submitLog("Hello, world!");
9-
errorInfo = null;
9+
errorInfo = "";
1010
message = "Hello, world!";
1111
};
1212
1313
async function tryCatchExample() {
1414
try {
1515
throw new Error("Caught in the try/catch");
1616
} catch (error) {
17-
message = null;
18-
errorInfo = error.message;
19-
await Exceptionless.submitException(error);
17+
message = "";
18+
if (error instanceof Error) {
19+
errorInfo = error.message;
20+
await Exceptionless.submitException(error);
21+
}
2022
}
2123
};
2224
@@ -33,22 +35,22 @@
3335
<p>
3436
Throw an uncaught error and make sure Exceptionless tracks it.
3537
</p>
36-
<button on:click={unhandledExceptionExample}>
38+
<button onclick={unhandledExceptionExample}>
3739
Throw unhandled error
3840
</button>
3941
</div>
4042
<p>
4143
The following buttons simulated handled events outside the
4244
component.
4345
</p>
44-
<button on:click={submitMessage}>Submit Message</button>
46+
<button onclick={submitMessage}>Submit Message</button>
4547
{#if message}
4648
<p>
4749
Message sent to Exceptionless:{" "}
4850
<code>{message}</code>
4951
</p>
5052
{/if}
51-
<button on:click={tryCatchExample}>Try/Catch Example</button>
53+
<button onclick={tryCatchExample}>Try/Catch Example</button>
5254
{#if errorInfo}
5355
<p>
5456
Error message sent to Exceptionless:{" "}

example/svelte-kit/vite.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { sveltekit } from "@sveltejs/kit/vite";
2-
import { defineConfig } from "vite";
1+
import { sveltekit } from "@sveltejs/kit/vite"
2+
import { defineConfig } from 'vitest/config';
33

44
export default defineConfig({
55
plugins: [sveltekit()]

0 commit comments

Comments
 (0)