@devicecloud.dev/dcd 3.7.8 → 3.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,8 @@ type StatusResponse = {
10
10
  uploadId?: string;
11
11
  appBinaryId?: string;
12
12
  consoleUrl?: string;
13
+ error?: string;
14
+ attempts?: number;
13
15
  };
14
16
  export default class Status extends Command {
15
17
  static description: string;
@@ -52,11 +52,40 @@ class Status extends core_1.Command {
52
52
  this.error('Either --name or --upload-id must be provided');
53
53
  return;
54
54
  }
55
+ let lastError = null;
56
+ let status = null;
57
+ for (let attempt = 1; attempt <= 5; attempt++) {
58
+ try {
59
+ status = (await ApiGateway_1.ApiGateway.getUploadStatus(apiUrl, apiKey, {
60
+ name,
61
+ uploadId,
62
+ }));
63
+ break;
64
+ }
65
+ catch (error) {
66
+ lastError = error;
67
+ if (attempt < 5) {
68
+ this.log(`Network error on attempt ${attempt}/5. Retrying...`);
69
+ await new Promise((resolve) => setTimeout(resolve, 1000 * attempt));
70
+ }
71
+ }
72
+ }
73
+ if (!status) {
74
+ const errorMessage = `Failed to get status after 5 attempts. Check your network. Last error: ${lastError?.message || 'Unknown error'}`;
75
+ if (json) {
76
+ return {
77
+ status: 'FAILED',
78
+ tests: [],
79
+ error: errorMessage,
80
+ attempts: 5,
81
+ };
82
+ }
83
+ else {
84
+ this.error(errorMessage);
85
+ return;
86
+ }
87
+ }
55
88
  try {
56
- const status = (await ApiGateway_1.ApiGateway.getUploadStatus(apiUrl, apiKey, {
57
- name,
58
- uploadId,
59
- }));
60
89
  if (json) {
61
90
  return status;
62
91
  }
@@ -556,5 +556,5 @@
556
556
  ]
557
557
  }
558
558
  },
559
- "version": "3.7.8"
559
+ "version": "3.7.9"
560
560
  }
package/package.json CHANGED
@@ -79,7 +79,7 @@
79
79
  "prepare": "yarn build",
80
80
  "version": "oclif readme && git add README.md"
81
81
  },
82
- "version": "3.7.8",
82
+ "version": "3.7.9",
83
83
  "bugs": {
84
84
  "url": "https://discord.gg/gm3mJwcNw8"
85
85
  },