Skip to content

Commit

Permalink
fix(davinci-client): address invalid client id with 302
Browse files Browse the repository at this point in the history
  • Loading branch information
cerebrl committed Dec 6, 2024
1 parent 33e46f7 commit f21ab7c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/davinci-client/src/lib/davinci.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ export function handleResponse(cacheEntry: DaVinciCacheEntry, dispatch: Dispatch
return;
}

/**
* Check for 3XX errors that result in CORS errors, reported as FETCH_ERROR
*/
if (cacheEntry.isError && cacheEntry.error.status === 'FETCH_ERROR') {
const data = {
code: cacheEntry.error.status,
message: 'Fetch Error: Please ensure a correct Client ID for your OAuth application.',
};
const requestId = cacheEntry.requestId;
dispatch(nodeSlice.actions.failure({ data, requestId, httpStatus: cacheEntry.error.status }));

return;
}

/**
* If the response's HTTP status is a success (2XX), but the DaVinci API has returned an error,
* we need to handle this as a failure or return as unknown.
Expand Down

0 comments on commit f21ab7c

Please sign in to comment.