summaryrefslogtreecommitdiff
path: root/jstests/libs/error_code_utils.js
blob: c23a2a53891479d21a00cf2e281ed21af5f38a06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * Helper functions for analyzing server errors.
 */

"use strict";

function includesErrorCode(serverReply, code) {
    if (serverReply.code === code) {
        return true;
    } else if (serverReply.writeErrors) {
        for (let e of serverReply.writeErrors) {
            if (e.code === code) {
                return true;
            }
        }
    }

    return false;
}