Skip to content

Commit fb02eac

Browse files
committed
feat(errors): add errors "ParseArchiveRegexError" and "NoRegexMatchError"
1 parent 0a22679 commit fb02eac

File tree

1 file changed

+14
-0
lines changed
  • packages/mongodb-memory-server-core/src/util

1 file changed

+14
-0
lines changed

packages/mongodb-memory-server-core/src/util/errors.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,17 @@ export class ReplsetCountLowError extends Error {
131131
super(`ReplSet Count needs to be 1 or higher! (specified count: "${count}")`);
132132
}
133133
}
134+
135+
export class ParseArchiveRegexError extends Error {
136+
constructor(public key: string) {
137+
super(`Expected "${key}" to be found in regex groups`);
138+
}
139+
}
140+
141+
export class NoRegexMatchError extends Error {
142+
constructor(public name: string, public extra?: string) {
143+
super();
144+
const addExtra = !!extra ? `(${extra})` : '';
145+
this.message = `Expected "${name}" to have Regex Matches${addExtra}`;
146+
}
147+
}

0 commit comments

Comments
 (0)