Skip to content

Commit

Permalink
fix(connect): better mobile fetch errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Nodonisko authored and mroz22 committed Dec 9, 2024
1 parent f6fa667 commit ad061ad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/connect/src/utils/assets.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ export function httpRequest<T extends HttpRequestType>(
...options,
})
.then(response => {
if (!response.ok) {
console.error('HTTP request failed', response);
throw new Error(
`HTTP request failed with status ${response.status} ${response.statusText}`,
);
}
if (type === 'binary') {
return response.arrayBuffer() as unknown as HttpRequestReturnType<T>;
}
Expand All @@ -23,7 +29,7 @@ export function httpRequest<T extends HttpRequestType>(
return response.text() as unknown as HttpRequestReturnType<T>;
})
.catch(error => {
console.error('httpRequest native error', error);
console.error('HTTP request failed', error);
throw error;
});
}
Expand Down

0 comments on commit ad061ad

Please sign in to comment.