Catch fetch errors

This commit is contained in:
Adria Navarro 2025-03-19 16:05:59 +01:00
parent 7f08f0d023
commit ccddac9010
1 changed files with 22 additions and 18 deletions

View File

@ -37,6 +37,7 @@ export async function validateConfig(config: {
clientId: string clientId: string
clientSecret: string clientSecret: string
}): Promise<{ valid: boolean; message?: string }> { }): Promise<{ valid: boolean; message?: string }> {
try {
const resp = await fetch(config.url, { const resp = await fetch(config.url, {
method: "POST", method: "POST",
headers: { headers: {
@ -57,4 +58,7 @@ export async function validateConfig(config: {
} }
return { valid: true } return { valid: true }
} catch (e: any) {
return { valid: false, message: e.message }
}
} }