@browserstack/mcp-server 1.2.34-beta.1 → 1.2.35-beta.1
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.
|
@@ -4,6 +4,7 @@ import { projectIdentifierToId, testCaseIdentifierToDetails, } from "./TCG-utils
|
|
|
4
4
|
import { pollLCAStatus } from "./poll-lca-status.js";
|
|
5
5
|
import { getBrowserStackAuth } from "../../lib/get-auth.js";
|
|
6
6
|
import { getTMBaseURL } from "../../lib/tm-base-url.js";
|
|
7
|
+
import logger from "../../logger.js";
|
|
7
8
|
/**
|
|
8
9
|
* Schema for creating LCA steps for a test case
|
|
9
10
|
*/
|
|
@@ -164,15 +165,16 @@ export async function createLCASteps(args, context, config) {
|
|
|
164
165
|
};
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
|
-
const
|
|
168
|
+
const detail = error?.response?.data?.message ||
|
|
168
169
|
error?.response?.data?.error ||
|
|
169
170
|
error?.message ||
|
|
170
171
|
String(error);
|
|
172
|
+
logger.error("Error creating LCA steps: %s", detail);
|
|
171
173
|
return {
|
|
172
174
|
content: [
|
|
173
175
|
{
|
|
174
176
|
type: "text",
|
|
175
|
-
text:
|
|
177
|
+
text: "Failed to create LCA steps. Please verify the inputs and try again",
|
|
176
178
|
},
|
|
177
179
|
],
|
|
178
180
|
isError: true,
|
|
@@ -33,6 +33,8 @@ config) {
|
|
|
33
33
|
// Wait for initial period before starting to poll
|
|
34
34
|
await new Promise((resolve) => setTimeout(resolve, initialWaitMs));
|
|
35
35
|
clearInterval(notificationIntervalId);
|
|
36
|
+
const maxConsecutiveErrors = 3;
|
|
37
|
+
let consecutiveErrors = 0;
|
|
36
38
|
return new Promise((resolve) => {
|
|
37
39
|
// Set up timeout to handle max wait time
|
|
38
40
|
const timeoutId = setTimeout(() => {
|
|
@@ -61,6 +63,7 @@ config) {
|
|
|
61
63
|
},
|
|
62
64
|
});
|
|
63
65
|
const responseData = response.data;
|
|
66
|
+
consecutiveErrors = 0;
|
|
64
67
|
if (responseData.data.success && responseData.data.test_case) {
|
|
65
68
|
const testCase = responseData.data.test_case;
|
|
66
69
|
// Check lcnc_build_map in both possible locations
|
|
@@ -107,7 +110,22 @@ config) {
|
|
|
107
110
|
}
|
|
108
111
|
catch (error) {
|
|
109
112
|
console.error("Error polling LCA status:", error);
|
|
110
|
-
|
|
113
|
+
consecutiveErrors++;
|
|
114
|
+
if (consecutiveErrors >= maxConsecutiveErrors) {
|
|
115
|
+
clearInterval(intervalId);
|
|
116
|
+
clearTimeout(timeoutId);
|
|
117
|
+
await context.sendNotification({
|
|
118
|
+
method: "notifications/progress",
|
|
119
|
+
params: {
|
|
120
|
+
progressToken: context._meta?.progressToken ?? `lca-${testCaseId}`,
|
|
121
|
+
message: `LCA build polling stopped after ${maxConsecutiveErrors} consecutive errors`,
|
|
122
|
+
progress: 100,
|
|
123
|
+
total: 100,
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
resolve(null);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
111
129
|
await context.sendNotification({
|
|
112
130
|
method: "notifications/progress",
|
|
113
131
|
params: {
|