Stop throwing in frontend code (#2654)

Return error instead of throw
This commit is contained in:
49fl
2024-06-24 11:45:40 -04:00
committed by GitHub
parent f7196e7eb0
commit f4877cb160
67 changed files with 5127 additions and 4523 deletions

View File

@ -123,7 +123,7 @@ async function getUser(context: UserContext) {
'Content-Type': 'application/json',
}
if (!token && isTauri()) throw new Error('No token found')
if (!token && isTauri()) return Promise.reject(new Error('No token found'))
if (token) headers['Authorization'] = `Bearer ${context.token}`
if (SKIP_AUTH)
@ -144,7 +144,7 @@ async function getUser(context: UserContext) {
const user = await userPromise
if ('error_code' in user) throw new Error(user.message)
if ('error_code' in user) return Promise.reject(new Error(user.message))
return {
user: user as Models['User_type'],