Commit fb691cf1 authored by Sam Chen's avatar Sam Chen Committed by GitHub

fix: catch vibrant failure (#4123)

fix: catch CORS error
parent f596293b
...@@ -46,7 +46,13 @@ async function getColorFromToken(token: Token): Promise<string | null> { ...@@ -46,7 +46,13 @@ async function getColorFromToken(token: Token): Promise<string | null> {
async function getColorFromUriPath(uri: string): Promise<string | null> { async function getColorFromUriPath(uri: string): Promise<string | null> {
const formattedPath = uriToHttp(uri)[0] const formattedPath = uriToHttp(uri)[0]
const palette = await Vibrant.from(formattedPath).getPalette() let palette
try {
palette = await Vibrant.from(formattedPath).getPalette()
} catch (err) {
return null
}
if (!palette?.Vibrant) { if (!palette?.Vibrant) {
return null return null
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment