mirror of
https://github.com/danbulant/Mangades
synced 2026-07-05 19:10:58 +00:00
more sentry data
This commit is contained in:
parent
13168158bd
commit
c5fe79c15d
3 changed files with 14 additions and 0 deletions
|
|
@ -28,6 +28,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sentry/browser": "^7.25.0",
|
"@sentry/browser": "^7.25.0",
|
||||||
|
"@sentry/node": "^7.25.0",
|
||||||
"fflate": "^0.6.10",
|
"fflate": "^0.6.10",
|
||||||
"streamsaver": "^2.0.6",
|
"streamsaver": "^2.0.6",
|
||||||
"svelte-local-storage-store": "^0.3.1",
|
"svelte-local-storage-store": "^0.3.1",
|
||||||
|
|
|
||||||
11
src/hooks.server.ts
Normal file
11
src/hooks.server.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
import * as Sentry from "@sentry/node";
|
||||||
|
/** @type {import('@sveltejs/kit').HandleClientError} */
|
||||||
|
export function handleError({ error, event }) {
|
||||||
|
// @ts-ignore
|
||||||
|
Sentry.captureException(error, { event });
|
||||||
|
|
||||||
|
return {
|
||||||
|
...error,
|
||||||
|
code: error?.code ?? 'UNKNOWN'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import * as Sentry from "@sentry/browser";
|
||||||
|
|
||||||
var isLogedInCache: boolean | null = null;
|
var isLogedInCache: boolean | null = null;
|
||||||
var isLogedInCacheTime: number | null = null;
|
var isLogedInCacheTime: number | null = null;
|
||||||
|
|
@ -20,6 +21,7 @@ export function isLogedIn() {
|
||||||
export function getUserID() {
|
export function getUserID() {
|
||||||
const token = localStorage.getItem("token")!;
|
const token = localStorage.getItem("token")!;
|
||||||
let data = JSON.parse(atob(token.substring(token.indexOf(".") + 1, token.lastIndexOf("."))));
|
let data = JSON.parse(atob(token.substring(token.indexOf(".") + 1, token.lastIndexOf("."))));
|
||||||
|
Sentry.setUser({ id: data.sub });
|
||||||
return data.sub;
|
return data.sub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue