Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Return the error message instead of the http status code

Gabe Kangas745ee8cced4b
diff --git a/web/utils/apis.ts b/web/utils/apis.ts
index 26063bf94f..1972f5745f 100644
--- a/web/utils/apis.ts
+++ b/web/utils/apis.ts
@@ -99,11 +99,12 @@ export async function fetchData(url: string, options?: FetchOptions) {
try {
const response = await fetch(url, requestOptions);
+ const json = await response.json();
+
if (!response.ok) {
- const message = `An error has occured: ${response.status}`;
+ const message = json.message || `An error has occurred: ${response.status}`;
throw new Error(message);
}
- const json = await response.json();
return json;
} catch (error) {
return error;