Catch fetch errors
This commit is contained in:
parent
7f08f0d023
commit
ccddac9010
|
@ -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 }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue