Skip to content
Snippets Groups Projects
Commit ba6ed354 authored by Daniel Bimschas's avatar Daniel Bimschas
Browse files

Merge branch 'HOLI-7493_handle_429' into 'main'

HOLI-7493 handle matrix response status 429 - Rate exceeded

See merge request app/holi-chat-integration!24
parents 3f701dd7 5c8536ff
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,15 @@ export const authedFetchResponse = async (url: string, method: string, body?: ob
init['body'] = JSON.stringify(body)
}
const response = await fetch(CHAT_SERVER_URL + url, init)
return { status: response.status, json: await response.json() }
if (response.status == 429) {
throw new Error('Matrix request failed with status 429: Rate exceeded')
}
try {
const json = await response.json()
return { status: response.status, json }
} catch {
return { status: response.status, json: {} }
}
}
export const authedFetchJson = async (url: string, method: string, body?: object) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment