8000 feat(1.0.6): add error categories · dmltdev/mongo-error-codes@0aac3de · GitHub
[go: up one dir, main page]

Skip to content

Commit 0aac3de

Browse files
committed
feat(1.0.6): add error categories
1 parent fb3e36a commit 0aac3de

File tree

3 files changed

+135
-15
lines changed

3 files changed

+135
-15
lines changed

readme.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ import { MongoErrorCodes } from "mongo-error-codes";
108108
console.log(MongoErrorCodes.DuplicateKey); // 11000
109109
```
110110

111+
#### `ErrorCategory` (type)
112+
113+
Represents an error category
114+
115+
```ts
116+
import { ErrorCategory } from 'monog-error-codes'
117+
118+
const errorCategory: ErrorCategory = "NotPrimaryError";
119+
```
120+
111121
#### `MongoError` (interface)
112122

113123
Represents a MongoDB error code object.
@@ -117,6 +127,7 @@ export interface MongoError {
117127
code: number;
118128
name: string;
119129
description?: string;
130+
categories?: ErrorCategory;
120131
}
121132
```
122133

0 commit comments

Comments
 (0)
0