Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): device list warnings keep the hub's error detail #25248

MergedJacksondr5(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/25248/headmerged by maria-rcks View on GitHub

Showing 2 changed files with 72 additions and 7 deletions.

x
0 of 2 viewed, 2 left
21 additions and 7 deletionsapps/server/src/device/DeviceHubOperations.tsModified
View file
@@ -39,6 +39,21 @@
),
});
​
+// Hub diagnostics can carry a whole stderr dump.
+const boundDiagnostics = (text: string) =>
+ text.length > 2_000 ? `${text.slice(0, 1_999)}…` : text;
+​
+// The hub's `error` is a util.inspect of Node's exec error; the stack and the
+// inspected fields follow the first frame, so keep the lines before it.
+const errorHead = (error: string) => {
+ const lines = error.split(/\r?\n/);
+ const firstFrame = lines.findIndex((line) => /^\s+at /.test(line));
+ return (firstFrame === -1 ? lines : lines.slice(0, firstFrame))
+ .map((line) => line.trim())
+ .filter(Boolean)
+ .join(" ");
+};
+​
const vendorPrefix = (platform: DevicePlatform) =>
platform === "ios" ? "/vendor/serve-sim" : "/vendor/serve-emu";
​
@@ -109,7 +124,11 @@
/(?:^Error:\s*ENOENT:|\bcode:\s*['"]ENOENT['"])/.test(error.error ?? "")
- const details = warnings?.map((error) => error.message) ?? [];
+ const details =
+ warnings?.map((error) => {