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

Function makeTimeoutError

src/sessions.ts:918–935  ·  view source on GitHub ↗
(cause: Error, csotEnabled: boolean)

Source from the content-addressed store, hash-verified

916}
917
918function makeTimeoutError(cause: Error, csotEnabled: boolean): Error {
919 // Async APIs know how to cancel themselves and might return CSOT error
920 if (cause instanceof MongoOperationTimeoutError) {
921 return cause;
922 }
923 if (csotEnabled) {
924 const timeoutError = new MongoOperationTimeoutError('Timed out during withTransaction', {
925 cause
926 });
927 if (cause instanceof MongoError) {
928 for (const label of cause.errorLabels) {
929 timeoutError.addErrorLabel(label);
930 }
931 }
932 return timeoutError;
933 }
934 return cause;
935}
936
937const NON_DETERMINISTIC_WRITE_CONCERN_ERRORS = new Set([
938 'CannotSatisfyWriteConcern',

Callers 1

withTransactionMethod · 0.85

Calls 1

addErrorLabelMethod · 0.80

Tested by

no test coverage detected