UNPKG

3.6 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.HttpErrorContext = exports.AnalyticsErrorContext = exports.SearchErrorContext = exports.QueryErrorContext = exports.ViewErrorContext = exports.KeyValueErrorContext = exports.ErrorContext = void 0;
4/**
5 * Generic base class for all known error context types.
6 *
7 * @category Error Handling
8 */
9class ErrorContext {
10}
11exports.ErrorContext = ErrorContext;
12/**
13 * The error context information for a key-value operation.
14 *
15 * @category Error Handling
16 */
17class KeyValueErrorContext extends ErrorContext {
18 /**
19 * @internal
20 */
21 constructor(data) {
22 super();
23 this.status_code = data.status_code;
24 this.opaque = data.opaque;
25 this.cas = data.cas;
26 this.key = data.key;
27 this.bucket = data.bucket;
28 this.collection = data.collection;
29 this.scope = data.scope;
30 this.context = data.context;
31 this.ref = data.ref;
32 }
33}
34exports.KeyValueErrorContext = KeyValueErrorContext;
35/**
36 * The error context information for a views operation.
37 *
38 * @category Error Handling
39 */
40class ViewErrorContext extends ErrorContext {
41 /**
42 * @internal
43 */
44 constructor(data) {
45 super();
46 this.design_document = data.design_document;
47 this.view = data.view;
48 this.parameters = data.parameters;
49 this.http_response_code = data.http_response_code;
50 this.http_response_body = data.http_response_body;
51 }
52}
53exports.ViewErrorContext = ViewErrorContext;
54/**
55 * The error context information for a query operation.
56 *
57 * @category Error Handling
58 */
59class QueryErrorContext extends ErrorContext {
60 /**
61 * @internal
62 */
63 constructor(data) {
64 super();
65 this.statement = data.statement;
66 this.client_context_id = data.client_context_id;
67 this.parameters = data.parameters;
68 this.http_response_code = data.http_response_code;
69 this.http_response_body = data.http_response_body;
70 }
71}
72exports.QueryErrorContext = QueryErrorContext;
73/**
74 * The error context information for a search query operation.
75 *
76 * @category Error Handling
77 */
78class SearchErrorContext extends ErrorContext {
79 /**
80 * @internal
81 */
82 constructor(data) {
83 super();
84 this.index_name = data.index_name;
85 this.query = data.query;
86 this.parameters = data.parameters;
87 this.http_response_code = data.http_response_code;
88 this.http_response_body = data.http_response_body;
89 }
90}
91exports.SearchErrorContext = SearchErrorContext;
92/**
93 * The error context information for an analytics query operation.
94 *
95 * @category Error Handling
96 */
97class AnalyticsErrorContext extends ErrorContext {
98 /**
99 * @internal
100 */
101 constructor(data) {
102 super();
103 this.statement = data.statement;
104 this.client_context_id = data.client_context_id;
105 this.parameters = data.parameters;
106 this.http_response_code = data.http_response_code;
107 this.http_response_body = data.http_response_body;
108 }
109}
110exports.AnalyticsErrorContext = AnalyticsErrorContext;
111/**
112 * The error context information for a http operation.
113 *
114 * @category Error Handling
115 */
116class HttpErrorContext extends ErrorContext {
117 /**
118 * @internal
119 */
120 constructor(data) {
121 super();
122 this.method = data.method;
123 this.request_path = data.request_path;
124 this.response_code = data.response_code;
125 this.response_body = data.response_body;
126 }
127}
128exports.HttpErrorContext = HttpErrorContext;