Personal Site
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

"handle" spotify sdk errors

+15 -1
+15 -1
src/components/home/playing/spotify/index.ts
··· 2 2 * types and logic for getting now playing information 3 3 */ 4 4 5 - import { SpotifyApi, type AccessToken } from "@spotify/web-api-ts-sdk"; 5 + import { 6 + SpotifyApi, 7 + type AccessToken, 8 + type IHandleErrors, 9 + } from "@spotify/web-api-ts-sdk"; 6 10 import { ProvidedAccessTokenStrategy } from "@spotify/web-api-ts-sdk"; 7 11 import { SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET } from "astro:env/server"; 8 12 ··· 110 114 return token; 111 115 }, 112 116 ), 117 + { 118 + errorHandler: new (class implements IHandleErrors { 119 + // log the error and pretend it was handled 120 + // this way it always returns null 121 + async handleErrors(error: any): Promise<boolean> { 122 + console.error(error); 123 + return true 124 + } 125 + })(), 126 + }, 113 127 );