MCPcopy
hub / github.com/watsonbox/exportify / apiCallErrorHandler

Function apiCallErrorHandler

src/helpers.ts:43–58  ·  view source on GitHub ↗
(error: any)

Source from the content-addressed store, hash-verified

41})
42
43export function apiCallErrorHandler(error: any) {
44 if (error.isAxiosError) {
45 if (error.request.status === 401) {
46 // Clear token and return to home page after auth token expiry
47 clearAccessToken()
48 window.location.href = window.location.pathname
49 return
50 } else if (error.request.status >= 500 && error.request.status < 600) {
51 // Show error page when we get a 5XX that fails retries
52 window.location.href = `${window.location.pathname}?spotify_error=true`
53 return
54 }
55 }
56
57 throw error
58}

Callers 2

PlaylistTableClass · 0.90
componentDidMountMethod · 0.90

Calls 1

clearAccessTokenFunction · 0.90

Tested by

no test coverage detected