Skip to content

Commit 2b725e7

Browse files
chore: export types for lib
1 parent c83c4db commit 2b725e7

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/common/connectionErrorHandler.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import type { ToolBase } from "../tools/tool.js";
55

66
export type ConnectionErrorHandler = (
77
error: MongoDBError<ErrorCodes.NotConnectedToMongoDB | ErrorCodes.MisconfiguredConnectionString>,
8-
additionalContext: {
9-
availableTools: ToolBase[];
10-
connectionState: AnyConnectionState;
11-
}
12-
) => { errorHandled: false } | { errorHandled: true; result: CallToolResult };
8+
additionalContext: ConnectionErrorHandlerContext
9+
) => ConnectionErrorUnhandled | ConnectionErrorHandled;
10+
11+
export type ConnectionErrorHandlerContext = { availableTools: ToolBase[]; connectionState: AnyConnectionState };
12+
export type ConnectionErrorUnhandled = { errorHandled: false };
13+
export type ConnectionErrorHandled = { errorHandled: true; result: CallToolResult };
1314

1415
export const connectionErrorHandler: ConnectionErrorHandler = (error, { availableTools, connectionState }) => {
1516
const connectTools = availableTools

src/lib.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,11 @@ export {
1111
type ConnectionStateErrored,
1212
type ConnectionManagerFactoryFn,
1313
} from "./common/connectionManager.js";
14-
export { type ConnectionErrorHandler } from "./common/connectionErrorHandler.js";
14+
export type {
15+
ConnectionErrorHandler,
16+
ConnectionErrorHandled,
17+
ConnectionErrorUnhandled,
18+
ConnectionErrorHandlerContext,
19+
} from "./common/connectionErrorHandler.js";
20+
export { ErrorCodes } from "./common/errors.js";
1521
export { Telemetry } from "./telemetry/telemetry.js";

0 commit comments

Comments
 (0)