@internal
(e: unknown)
| 161 | |
| 162 | /** @internal */ |
| 163 | static buildErrorMessage(e: unknown): string { |
| 164 | if (typeof e === 'string') { |
| 165 | return e; |
| 166 | } |
| 167 | if (isAggregateError(e) && e.message.length === 0) { |
| 168 | return e.errors.length === 0 |
| 169 | ? 'AggregateError has an empty errors array. Please check the `cause` property for more information.' |
| 170 | : e.errors.map(({ message }) => message).join(', '); |
| 171 | } |
| 172 | |
| 173 | return e != null && typeof e === 'object' && 'message' in e && typeof e.message === 'string' |
| 174 | ? e.message |
| 175 | : 'empty error message'; |
| 176 | } |
| 177 | |
| 178 | override get name(): string { |
| 179 | return 'MongoError'; |
no test coverage detected