MCPcopy
hub / github.com/mongodb/node-mongodb-native / buildErrorMessage

Method buildErrorMessage

src/error.ts:163–176  ·  view source on GitHub ↗

@internal

(e: unknown)

Source from the content-addressed store, hash-verified

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';

Callers 5

error.test.tsFile · 0.80
constructorMethod · 0.80
makeSocketFunction · 0.80
makeSocks5ConnectionFunction · 0.80
onHeartbeatFailedFunction · 0.80

Calls 2

isAggregateErrorFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected