From ee903cb79f341c6052f058f48a61b6ed2e566f50 Mon Sep 17 00:00:00 2001 From: Warren James <28974128+W-A-James@users.noreply.github.com> Date: Thu, 8 Jul 2021 12:11:34 -0400 Subject: [PATCH] feat(NODE-3410): added MongoRuntimeError (#2892) --- src/error.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/error.ts b/src/error.ts index eb79d8bd2e..6e721b39f0 100644 --- a/src/error.ts +++ b/src/error.ts @@ -178,6 +178,26 @@ export class MongoDriverError extends MongoError { } } +/** + * An error generated when the driver encounters unexpected input + * or reaches an unexpected/invalid internal state + * + * @privateRemarks + * Should **never** be directly instantiated. + * + * @public + * @category Error + */ +export class MongoRuntimeError extends MongoDriverError { + protected constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoRuntimeError'; + } +} + /** @internal */ const kBeforeHandshake = Symbol('beforeHandshake'); export function isNetworkErrorBeforeHandshake(err: MongoNetworkError): boolean {