We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5c12189 commit 9e9435bCopy full SHA for 9e9435b
1 file changed
src/helpers.ts
@@ -34,7 +34,21 @@ export async function downloadFile(
34
): Promise<DownloadResponse> {
35
const response = await fetch(url);
36
if (!response.ok) {
37
- throw new Error("Response error.");
+ let responseText = "";
38
+ try {
39
+ responseText = await response.text();
40
+ } catch {
41
+ responseText = "";
42
+ }
43
+ const details = [
44
+ `status=${response.status}`,
45
+ `statusText=${response.statusText || "unknown"}`,
46
+ ];
47
+ if (responseText) {
48
+ details.push(`body=${responseText.slice(0, 500)}`);
49
50
+ details.push(`url=${url}`);
51
+ throw new Error(`Response error. ${details.join(" ")}`);
52
}
53
54
const defaultName = !isNaN(index) && index > -1 ? `file_${index}.out` : 'file.out'
0 commit comments