Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/modules/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ function unwrapErrorCauses(error: Error): ChainedErrorData[] {
if (!(currentError instanceof Error)) {
chainedErrors.push({
message: stringifyNonError(currentError),
type: "UnknownErrorType",
type: undefined,
});
break;
}
Expand Down Expand Up @@ -760,7 +760,7 @@ function captureCallToolResultError(

const errorData: ErrorData = {
message,
type: "UnknownErrorType", // Can't determine actual type from CallToolResult
type: undefined, // Can't determine actual type from CallToolResult
platform: "javascript",
// No stack or frames - SDK stripped the original error information
};
Expand Down
12 changes: 7 additions & 5 deletions src/tests/error-capture.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ describe("Error Capture Integration Tests", () => {
const errorEvent = events.find((e) => e.isError);

expect(errorEvent).toBeDefined();
expect(errorEvent!.error!.type).toBe("UnknownErrorType");
expect(errorEvent!.error!.type).toBeUndefined();
expect(errorEvent!.error!.message).toContain("This is a string error");
// Non-Error throws don't have stack traces
// (SDK converts them, we can't capture at callback level)
Expand Down Expand Up @@ -486,8 +486,8 @@ describe("Error Capture Integration Tests", () => {
expect(errorEvent!.error!.message).toContain("Invalid");

// Type can vary by SDK version
// SDK 1.11.5: "McpError", SDK 1.21.0+: "UnknownErrorType"
expect(["McpError", "UnknownErrorType", "Error"]).toContain(
// SDK 1.11.5: "McpError" (actual Error), SDK 1.21.0+: undefined (CallToolResult)
expect(["McpError", "Error", undefined]).toContain(
errorEvent!.error!.type,
);

Expand Down Expand Up @@ -550,7 +550,8 @@ describe("Error Capture Integration Tests", () => {
expect(errorEvent!.error!.message).toContain("not found");

// Type can vary by SDK version
expect(["McpError", "UnknownErrorType", "Error"]).toContain(
// SDK 1.11.5: "McpError" (actual Error), SDK 1.21.0+: undefined (CallToolResult)
expect(["McpError", "Error", undefined]).toContain(
errorEvent!.error!.type,
);

Expand Down Expand Up @@ -606,7 +607,8 @@ describe("Error Capture Integration Tests", () => {
expect(errorEvent!.error!.message).toContain("Invalid");

// Type can vary by SDK version
expect(["McpError", "UnknownErrorType", "Error"]).toContain(
// SDK 1.11.5: "McpError" (actual Error), SDK 1.21.0+: undefined (CallToolResult)
expect(["McpError", "Error", undefined]).toContain(
errorEvent!.error!.type,
);

Expand Down
2 changes: 1 addition & 1 deletion src/tests/exceptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ describe("captureException", () => {
expect(result.chained_errors).toBeDefined();
expect(result.chained_errors!.length).toBe(1);
expect(result.chained_errors![0].message).toBe("string cause");
expect(result.chained_errors![0].type).toBe("UnknownErrorType");
expect(result.chained_errors![0].type).toBeUndefined();
});

it("should detect circular cause references", () => {
Expand Down