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

Method constructor

src/error.ts:228–247  ·  view source on GitHub ↗

* **Do not use this constructor!** * * Meant for internal use only. * * @remarks * This class is only meant to be constructed within the driver. This constructor is * not subject to semantic versioning compatibility guarantees and may change at any time. * * @public

(message: ErrorDescription)

Source from the content-addressed store, hash-verified

226 * @public
227 **/
228 constructor(message: ErrorDescription) {
229 super(message.message || message.errmsg || message.$err || 'n/a');
230
231 if (message.errorLabels) {
232 for (const label of message.errorLabels) this.addErrorLabel(label);
233 }
234
235 this.errorResponse = message;
236
237 for (const name in message) {
238 if (
239 name !== 'errorLabels' &&
240 name !== 'errmsg' &&
241 name !== 'message' &&
242 name !== 'errorResponse'
243 ) {
244 this[name] = message[name];
245 }
246 }
247 }
248
249 override get name(): string {
250 return 'MongoServerError';

Callers

nothing calls this directly

Calls 1

addErrorLabelMethod · 0.80

Tested by

no test coverage detected