fix(web): login error handling ()

This commit is contained in:
Jason Rasmussen 2023-01-13 17:04:59 -05:00 committed by GitHub
parent ba04b753de
commit 5fb3ea465f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 154 additions and 35 deletions

View file

@ -1,5 +1,15 @@
import type { Handle } from '@sveltejs/kit';
import type { Handle, HandleServerError } from '@sveltejs/kit';
import { AxiosError } from 'axios';
export const handle: Handle = async ({ event, resolve }) => {
return await resolve(event);
};
export const handleError: HandleServerError = async ({ error }) => {
const httpError = error as AxiosError;
return {
message: httpError?.message || 'Hmm, not sure about that. Check the logs or open a ticket?',
stack: httpError?.stack,
code: httpError.code || '500'
};
};