@botbotgo/better-call 0.1.34 → 0.1.35
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.
- package/package.json +1 -1
- package/scripts/demo.mjs +29 -2
package/package.json
CHANGED
package/scripts/demo.mjs
CHANGED
|
@@ -7,6 +7,29 @@ function errorMessage(error) {
|
|
|
7
7
|
return error instanceof Error ? error.message : String(error);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
function errorDetails(error) {
|
|
11
|
+
if (error instanceof Error) {
|
|
12
|
+
const causeMessage =
|
|
13
|
+
error.cause instanceof Error
|
|
14
|
+
? error.cause.message
|
|
15
|
+
: error.cause != null
|
|
16
|
+
? String(error.cause)
|
|
17
|
+
: null;
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
message: error.message,
|
|
21
|
+
type: error.name || "Error",
|
|
22
|
+
cause: causeMessage,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
message: String(error),
|
|
28
|
+
type: typeof error,
|
|
29
|
+
cause: null,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
10
33
|
function exitWithError(step, error) {
|
|
11
34
|
const message = errorMessage(error);
|
|
12
35
|
|
|
@@ -109,11 +132,15 @@ try {
|
|
|
109
132
|
},
|
|
110
133
|
});
|
|
111
134
|
} catch (error) {
|
|
135
|
+
const details = errorDetails(error);
|
|
112
136
|
gatewayResult = {
|
|
113
137
|
status: "error",
|
|
114
138
|
originalToolName: "research",
|
|
115
139
|
toolName: null,
|
|
116
|
-
reason: `repairToolCall failed: ${
|
|
140
|
+
reason: `repairToolCall failed: ${details.message}`,
|
|
141
|
+
errorType: details.type,
|
|
142
|
+
errorMessage: details.message,
|
|
143
|
+
errorCause: details.cause,
|
|
117
144
|
};
|
|
118
145
|
}
|
|
119
146
|
|
|
@@ -147,7 +174,7 @@ if (json) {
|
|
|
147
174
|
console.log("");
|
|
148
175
|
console.log("3. Gateway tool-name repair");
|
|
149
176
|
console.log(` status: ${report.gatewayRepair.status}`);
|
|
150
|
-
console.log(` tool: ${report.gatewayRepair.originalToolName} -> ${report.gatewayRepair.toolName}`);
|
|
177
|
+
console.log(` tool: ${report.gatewayRepair.originalToolName} -> ${report.gatewayRepair.toolName ?? "(none)"}`);
|
|
151
178
|
console.log(` reason: ${report.gatewayRepair.reason ?? "(none)"}`);
|
|
152
179
|
console.log("");
|
|
153
180
|
console.log("Run with --json for the full structured result.");
|