diff --git a/frontend/src/app/api/auth/[...nextauth]/route.ts b/frontend/src/app/api/auth/[...nextauth]/route.ts index b527298819..74f35938cd 100644 --- a/frontend/src/app/api/auth/[...nextauth]/route.ts +++ b/frontend/src/app/api/auth/[...nextauth]/route.ts @@ -18,7 +18,9 @@ async function checkIfProjectLeader(login: string): Promise { }) return data?.isProjectLeader ?? false } catch (err) { - throw new Error('Failed to fetch project leader status Error', err) + throw new Error( + `Failed to fetch project leader status: ${err instanceof Error ? err.message : String(err)}` + ) } } @@ -32,7 +34,9 @@ async function checkIfMentor(login: string): Promise { }) return data?.isMentor ?? false } catch (err) { - throw new Error('Failed to fetch mentor status Error', err) + throw new Error( + `Failed to fetch mentor status: ${err instanceof Error ? err.message : String(err)}` + ) } } diff --git a/frontend/src/components/ModuleForm.tsx b/frontend/src/components/ModuleForm.tsx index 0768291a4e..a3cd18f048 100644 --- a/frontend/src/components/ModuleForm.tsx +++ b/frontend/src/components/ModuleForm.tsx @@ -286,7 +286,9 @@ export const ProjectSelector = ({ value, defaultName, onProjectChange }: Project } catch (err) { setRawResults([]) setShowSuggestions(false) - throw new Error('Error fetching suggestions:', err) + setError( + `Error fetching suggestions: ${err instanceof Error ? err.message : String(err || 'Unknown error')}` + ) } }, 300), [client]