(cause: Error, csotEnabled: boolean)
| 916 | } |
| 917 | |
| 918 | function 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 | |
| 937 | const NON_DETERMINISTIC_WRITE_CONCERN_ERRORS = new Set([ |
| 938 | 'CannotSatisfyWriteConcern', |
no test coverage detected