Skip to content

Commit 9c74a83

Browse files
committed
fix: add more debug logging to TS e2e tests
1 parent 3e8a191 commit 9c74a83

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

e2e_tests/typescript/src/chat_session.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,17 @@ export class ChatSession {
2727
logger.info(`Agent invocation completed in ${duration}ms`);
2828
} catch (error) {
2929
const duration = Date.now() - startTime;
30-
logger.error(`Agent invocation failed after ${duration}ms:`, error);
30+
logger.error(`Agent invocation failed after ${duration}ms: ${error}`);
31+
if (error instanceof Error) {
32+
logger.error(`Error name: ${error.name}`);
33+
logger.error(`Error message: ${error.message}`);
34+
if (error.stack) {
35+
logger.error(`Error stack: ${error.stack}`);
36+
}
37+
if ('cause' in error && error.cause) {
38+
logger.error(`Error cause: ${JSON.stringify(error.cause, null, 2)}`);
39+
}
40+
}
3141
throw error;
3242
}
3343
}

e2e_tests/typescript/src/main.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,14 @@ async function main(): Promise<void> {
6161
logger.info(`Loaded ${userUtterances.length} test questions`);
6262

6363
logger.info("Initializing Bedrock model...");
64+
const region = typeof config.bedrockClient.config.region === 'function'
65+
? await config.bedrockClient.config.region()
66+
: config.bedrockClient.config.region;
6467
const model = new BedrockModel({
65-
region: config.bedrockClient.config.region as string,
68+
region: region as string,
6669
modelId: config.modelId,
6770
});
68-
logger.info(`Using model: ${config.modelId} in region: ${config.bedrockClient.config.region}`);
71+
logger.info(`Using model: ${config.modelId} in region: ${region}`);
6972

7073
logger.info("Creating agent...");
7174
const agent = new Agent({
@@ -89,8 +92,15 @@ process.on("unhandledRejection", (reason, promise) => {
8992

9093
main().catch((error) => {
9194
logger.error("Error in main:", error);
92-
if (error.stack) {
93-
logger.error("Stack trace:", error.stack);
95+
if (error instanceof Error) {
96+
logger.error(`Error type: ${error.constructor.name}`);
97+
logger.error(`Error message: ${error.message}`);
98+
if (error.stack) {
99+
logger.error("Stack trace:", error.stack);
100+
}
101+
if ('cause' in error && error.cause) {
102+
logger.error("Error cause:", JSON.stringify(error.cause, null, 2));
103+
}
94104
}
95105
process.exit(1);
96106
});

0 commit comments

Comments
 (0)