From bf5d57619d10c33c57f49e892b704418759fe3f5 Mon Sep 17 00:00:00 2001 From: Kevin Kipp Date: Mon, 16 Sep 2024 10:32:11 -0500 Subject: [PATCH] Improve error message when creating sessions --- app/utils/rxjs/RxjsPeer.client.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/utils/rxjs/RxjsPeer.client.ts b/app/utils/rxjs/RxjsPeer.client.ts index 73eabe32..6f173d69 100644 --- a/app/utils/rxjs/RxjsPeer.client.ts +++ b/app/utils/rxjs/RxjsPeer.client.ts @@ -188,8 +188,13 @@ export class RxjsPeer { if (response.status > 400) { throw new Error('Error creating Calls session') } - const { sessionId } = (await response.json()) as any - return { peerConnection, sessionId } + + try { + const { sessionId } = (await response.clone().json()) as any + return { peerConnection, sessionId } + } catch (error) { + throw new Error(response.status + ': ' + (await response.text())) + } } async fetchWithRecordedHistory(path: string, requestInit?: RequestInit) {