1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
19 | exports.restrictControlPlaneStatusCode = void 0;
|
20 | const constants_1 = require("./constants");
|
21 | const INAPPROPRIATE_CONTROL_PLANE_CODES = [
|
22 | constants_1.Status.OK,
|
23 | constants_1.Status.INVALID_ARGUMENT,
|
24 | constants_1.Status.NOT_FOUND,
|
25 | constants_1.Status.ALREADY_EXISTS,
|
26 | constants_1.Status.FAILED_PRECONDITION,
|
27 | constants_1.Status.ABORTED,
|
28 | constants_1.Status.OUT_OF_RANGE,
|
29 | constants_1.Status.DATA_LOSS
|
30 | ];
|
31 | function restrictControlPlaneStatusCode(code, details) {
|
32 | if (INAPPROPRIATE_CONTROL_PLANE_CODES.includes(code)) {
|
33 | return {
|
34 | code: constants_1.Status.INTERNAL,
|
35 | details: `Invalid status from control plane: ${code} ${constants_1.Status[code]} ${details}`
|
36 | };
|
37 | }
|
38 | else {
|
39 | return { code, details };
|
40 | }
|
41 | }
|
42 | exports.restrictControlPlaneStatusCode = restrictControlPlaneStatusCode;
|
43 |
|
\ | No newline at end of file |