@api-client/core 0.12.10 → 0.12.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/build/src/browser.d.ts +0 -1
  2. package/build/src/browser.d.ts.map +1 -1
  3. package/build/src/browser.js +0 -1
  4. package/build/src/browser.js.map +1 -1
  5. package/build/src/exceptions/exception.d.ts +29 -1
  6. package/build/src/exceptions/exception.d.ts.map +1 -1
  7. package/build/src/exceptions/exception.js +37 -1
  8. package/build/src/exceptions/exception.js.map +1 -1
  9. package/build/src/index.d.ts +0 -1
  10. package/build/src/index.d.ts.map +1 -1
  11. package/build/src/index.js +0 -1
  12. package/build/src/index.js.map +1 -1
  13. package/build/src/proxy/HttpProjectProxy.d.ts.map +1 -1
  14. package/build/src/proxy/HttpProjectProxy.js +39 -43
  15. package/build/src/proxy/HttpProjectProxy.js.map +1 -1
  16. package/build/src/proxy/RequestProxy.d.ts.map +1 -1
  17. package/build/src/proxy/RequestProxy.js +11 -11
  18. package/build/src/proxy/RequestProxy.js.map +1 -1
  19. package/build/src/runtime/store/DataCatalogSdk.d.ts.map +1 -1
  20. package/build/src/runtime/store/DataCatalogSdk.js +49 -109
  21. package/build/src/runtime/store/DataCatalogSdk.js.map +1 -1
  22. package/build/src/runtime/store/FilesSdk.d.ts.map +1 -1
  23. package/build/src/runtime/store/FilesSdk.js +51 -115
  24. package/build/src/runtime/store/FilesSdk.js.map +1 -1
  25. package/build/src/runtime/store/HistorySdk.d.ts.map +1 -1
  26. package/build/src/runtime/store/HistorySdk.js +25 -70
  27. package/build/src/runtime/store/HistorySdk.js.map +1 -1
  28. package/build/src/runtime/store/OrganizationsSdk.d.ts.map +1 -1
  29. package/build/src/runtime/store/OrganizationsSdk.js +46 -50
  30. package/build/src/runtime/store/OrganizationsSdk.js.map +1 -1
  31. package/build/src/runtime/store/RevisionsSdk.d.ts.map +1 -1
  32. package/build/src/runtime/store/RevisionsSdk.js +5 -10
  33. package/build/src/runtime/store/RevisionsSdk.js.map +1 -1
  34. package/build/src/runtime/store/SdkBase.d.ts +7 -5
  35. package/build/src/runtime/store/SdkBase.d.ts.map +1 -1
  36. package/build/src/runtime/store/SdkBase.js +45 -63
  37. package/build/src/runtime/store/SdkBase.js.map +1 -1
  38. package/build/src/runtime/store/SharedSdk.d.ts.map +1 -1
  39. package/build/src/runtime/store/SharedSdk.js +5 -14
  40. package/build/src/runtime/store/SharedSdk.js.map +1 -1
  41. package/build/src/runtime/store/TrashSdk.d.ts.map +1 -1
  42. package/build/src/runtime/store/TrashSdk.js +8 -28
  43. package/build/src/runtime/store/TrashSdk.js.map +1 -1
  44. package/build/src/runtime/store/UsersSdk.d.ts.map +1 -1
  45. package/build/src/runtime/store/UsersSdk.js +12 -11
  46. package/build/src/runtime/store/UsersSdk.js.map +1 -1
  47. package/data/models/example-generator-api.json +8 -8
  48. package/package.json +1 -1
  49. package/src/exceptions/exception.ts +51 -4
  50. package/src/proxy/HttpProjectProxy.ts +39 -43
  51. package/src/proxy/RequestProxy.ts +11 -11
  52. package/src/runtime/store/DataCatalogSdk.ts +49 -109
  53. package/src/runtime/store/FilesSdk.ts +51 -115
  54. package/src/runtime/store/HistorySdk.ts +25 -70
  55. package/src/runtime/store/OrganizationsSdk.ts +46 -50
  56. package/src/runtime/store/RevisionsSdk.ts +5 -10
  57. package/src/runtime/store/SdkBase.ts +46 -65
  58. package/src/runtime/store/SharedSdk.ts +5 -14
  59. package/src/runtime/store/TrashSdk.ts +8 -28
  60. package/src/runtime/store/UsersSdk.ts +12 -11
  61. package/tests/unit/runtime/proxy/HttpProjectProxy.spec.ts +42 -40
  62. package/tests/unit/runtime/proxy/RequestProxy.spec.ts +11 -11
  63. package/build/src/runtime/store/Errors.d.ts +0 -51
  64. package/build/src/runtime/store/Errors.d.ts.map +0 -1
  65. package/build/src/runtime/store/Errors.js +0 -61
  66. package/build/src/runtime/store/Errors.js.map +0 -1
  67. package/src/runtime/store/Errors.ts +0 -98
@@ -14,11 +14,11 @@ import type {
14
14
  DataCatalogStatus,
15
15
  } from '../../models/DataCatalog.js'
16
16
  import { RouteBuilder } from './RouteBuilder.js'
17
- import { SdkError } from './Errors.js'
18
17
  import { DataCatalogKind, DataCatalogVersionKind } from '../../models/kinds.js'
19
18
  import type { DataCatalogVersionSchema } from '../../models/DataCatalogVersion.js'
20
19
  import type { ForeignDomainDependency } from '../../modeling/types.js'
21
20
  import type { DataDomainSchema } from '../../modeling/DataDomain.js'
21
+ import { Exception } from '../../exceptions/exception.js'
22
22
 
23
23
  export interface DataCatalogListOptions extends ContextListOptions {
24
24
  scope?: DataCatalogScope
@@ -41,25 +41,20 @@ export class DataCatalogSdk extends SdkBase {
41
41
  const E_PREFIX = 'Unable to list data domains. '
42
42
  if (result.status !== 200) {
43
43
  this.logInvalidResponse(result)
44
- let e = this.createGenericSdkError(result.body)
45
- if (!e) {
46
- e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
47
- e.response = result.body
48
- }
49
- throw e
44
+ throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
50
45
  }
51
46
  if (!result.body) {
52
- throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
47
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
53
48
  }
54
49
 
55
50
  let data: ContextListResult<DataCatalogSchemaWithVersion>
56
51
  try {
57
52
  data = JSON.parse(result.body)
58
53
  } catch {
59
- throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
54
+ throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
60
55
  }
61
56
  if (!Array.isArray(data.items)) {
62
- throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
57
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
63
58
  }
64
59
  return data
65
60
  }
@@ -75,24 +70,19 @@ export class DataCatalogSdk extends SdkBase {
75
70
  const E_PREFIX = 'Unable to list data domain versions. '
76
71
  if (result.status !== 200) {
77
72
  this.logInvalidResponse(result)
78
- let e = this.createGenericSdkError(result.body)
79
- if (!e) {
80
- e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
81
- e.response = result.body
82
- }
83
- throw e
73
+ throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
84
74
  }
85
75
  if (!result.body) {
86
- throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
76
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
87
77
  }
88
78
  let data: ContextListResult<{ key: string; version: string; published: number }>
89
79
  try {
90
80
  data = JSON.parse(result.body)
91
81
  } catch {
92
- throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
82
+ throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
93
83
  }
94
84
  if (!Array.isArray(data.items)) {
95
- throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
85
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
96
86
  }
97
87
  return data
98
88
  }
@@ -118,25 +108,20 @@ export class DataCatalogSdk extends SdkBase {
118
108
  const E_PREFIX = 'Unable to publish data domain. '
119
109
  if (result.status !== 200) {
120
110
  this.logInvalidResponse(result)
121
- let e = this.createGenericSdkError(result.body)
122
- if (!e) {
123
- e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
124
- e.response = result.body
125
- }
126
- throw e
111
+ throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
127
112
  }
128
113
 
129
114
  if (!result.body) {
130
- throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
115
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
131
116
  }
132
117
  let data: ContextChangeRecord<DataCatalogSchema>
133
118
  try {
134
119
  data = JSON.parse(result.body)
135
120
  } catch {
136
- throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
121
+ throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
137
122
  }
138
123
  if (!data.key) {
139
- throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
124
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
140
125
  }
141
126
  return data
142
127
  }
@@ -149,24 +134,19 @@ export class DataCatalogSdk extends SdkBase {
149
134
  const E_PREFIX = 'Unable to read data domain. '
150
135
  if (result.status !== 200) {
151
136
  this.logInvalidResponse(result)
152
- let e = this.createGenericSdkError(result.body)
153
- if (!e) {
154
- e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
155
- e.response = result.body
156
- }
157
- throw e
137
+ throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
158
138
  }
159
139
  if (!result.body) {
160
- throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
140
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
161
141
  }
162
142
  let data: DataCatalogSchema
163
143
  try {
164
144
  data = JSON.parse(result.body)
165
145
  } catch {
166
- throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
146
+ throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
167
147
  }
168
148
  if (data.kind !== DataCatalogKind) {
169
- throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
149
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
170
150
  }
171
151
  return data
172
152
  }
@@ -196,24 +176,19 @@ export class DataCatalogSdk extends SdkBase {
196
176
  const E_PREFIX = 'Unable to deprecate data domain. '
197
177
  if (result.status !== 200) {
198
178
  this.logInvalidResponse(result)
199
- let e = this.createGenericSdkError(result.body)
200
- if (!e) {
201
- e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
202
- e.response = result.body
203
- }
204
- throw e
179
+ throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
205
180
  }
206
181
  if (!result.body) {
207
- throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
182
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
208
183
  }
209
184
  let data: ContextChangeRecord<DataCatalogSchema>
210
185
  try {
211
186
  data = JSON.parse(result.body)
212
187
  } catch {
213
- throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
188
+ throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
214
189
  }
215
190
  if (data.kind !== DataCatalogKind) {
216
- throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
191
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
217
192
  }
218
193
  return data
219
194
  }
@@ -232,24 +207,19 @@ export class DataCatalogSdk extends SdkBase {
232
207
  const E_PREFIX = 'Unable to unpublish data domain. '
233
208
  if (result.status !== 200) {
234
209
  this.logInvalidResponse(result)
235
- let e = this.createGenericSdkError(result.body)
236
- if (!e) {
237
- e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
238
- e.response = result.body
239
- }
240
- throw e
210
+ throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
241
211
  }
242
212
  if (!result.body) {
243
- throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
213
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
244
214
  }
245
215
  let data: ContextChangeRecord<DataCatalogSchema>
246
216
  try {
247
217
  data = JSON.parse(result.body)
248
218
  } catch {
249
- throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
219
+ throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
250
220
  }
251
221
  if (data.kind !== DataCatalogKind) {
252
- throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
222
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
253
223
  }
254
224
  return data
255
225
  }
@@ -273,24 +243,19 @@ export class DataCatalogSdk extends SdkBase {
273
243
  const E_PREFIX = 'Unable to publish data domain version. '
274
244
  if (result.status !== 200) {
275
245
  this.logInvalidResponse(result)
276
- let e = this.createGenericSdkError(result.body)
277
- if (!e) {
278
- e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
279
- e.response = result.body
280
- }
281
- throw e
246
+ throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
282
247
  }
283
248
  if (!result.body) {
284
- throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
249
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
285
250
  }
286
251
  let data: ContextChangeRecord<DataCatalogVersionSchema>
287
252
  try {
288
253
  data = JSON.parse(result.body)
289
254
  } catch {
290
- throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
255
+ throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
291
256
  }
292
257
  if (data.kind !== DataCatalogVersionKind) {
293
- throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
258
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
294
259
  }
295
260
  return data
296
261
  }
@@ -303,24 +268,19 @@ export class DataCatalogSdk extends SdkBase {
303
268
  const E_PREFIX = 'Unable to read data domain version. '
304
269
  if (result.status !== 200) {
305
270
  this.logInvalidResponse(result)
306
- let e = this.createGenericSdkError(result.body)
307
- if (!e) {
308
- e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
309
- e.response = result.body
310
- }
311
- throw e
271
+ throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
312
272
  }
313
273
  if (!result.body) {
314
- throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
274
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
315
275
  }
316
276
  let data: DataCatalogVersionSchema
317
277
  try {
318
278
  data = JSON.parse(result.body)
319
279
  } catch {
320
- throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
280
+ throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
321
281
  }
322
282
  if (data.kind !== DataCatalogVersionKind) {
323
- throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
283
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
324
284
  }
325
285
  return data
326
286
  }
@@ -343,24 +303,19 @@ export class DataCatalogSdk extends SdkBase {
343
303
  const E_PREFIX = 'Unable to list data domain dependencies. '
344
304
  if (result.status !== 200) {
345
305
  this.logInvalidResponse(result)
346
- let e = this.createGenericSdkError(result.body)
347
- if (!e) {
348
- e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
349
- e.response = result.body
350
- }
351
- throw e
306
+ throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
352
307
  }
353
308
  if (!result.body) {
354
- throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
309
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
355
310
  }
356
311
  let data: ContextListResult<DataDomainSchema[]>
357
312
  try {
358
313
  data = JSON.parse(result.body)
359
314
  } catch {
360
- throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
315
+ throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
361
316
  }
362
317
  if (!Array.isArray(data.items)) {
363
- throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
318
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
364
319
  }
365
320
  return data
366
321
  }
@@ -385,24 +340,19 @@ export class DataCatalogSdk extends SdkBase {
385
340
  const E_PREFIX = 'Unable to deprecate data domain version. '
386
341
  if (result.status !== 200) {
387
342
  this.logInvalidResponse(result)
388
- let e = this.createGenericSdkError(result.body)
389
- if (!e) {
390
- e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
391
- e.response = result.body
392
- }
393
- throw e
343
+ throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
394
344
  }
395
345
  if (!result.body) {
396
- throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
346
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
397
347
  }
398
348
  let data: ContextChangeRecord<DataCatalogVersionSchema>
399
349
  try {
400
350
  data = JSON.parse(result.body)
401
351
  } catch {
402
- throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
352
+ throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
403
353
  }
404
354
  if (data.kind !== DataCatalogVersionKind) {
405
- throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
355
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
406
356
  }
407
357
  return data
408
358
  }
@@ -419,24 +369,19 @@ export class DataCatalogSdk extends SdkBase {
419
369
  const E_PREFIX = 'Unable to unpublish data domain version. '
420
370
  if (result.status !== 200) {
421
371
  this.logInvalidResponse(result)
422
- let e = this.createGenericSdkError(result.body)
423
- if (!e) {
424
- e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
425
- e.response = result.body
426
- }
427
- throw e
372
+ throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
428
373
  }
429
374
  if (!result.body) {
430
- throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
375
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
431
376
  }
432
377
  let data: ContextChangeRecord<DataCatalogVersionSchema>
433
378
  try {
434
379
  data = JSON.parse(result.body)
435
380
  } catch {
436
- throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
381
+ throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
437
382
  }
438
383
  if (data.kind !== DataCatalogVersionKind) {
439
- throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
384
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
440
385
  }
441
386
  return data
442
387
  }
@@ -449,24 +394,19 @@ export class DataCatalogSdk extends SdkBase {
449
394
  const E_PREFIX = 'Unable to check data domain publication status. '
450
395
  if (result.status !== 200) {
451
396
  this.logInvalidResponse(result)
452
- let e = this.createGenericSdkError(result.body)
453
- if (!e) {
454
- e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
455
- e.response = result.body
456
- }
457
- throw e
397
+ throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
458
398
  }
459
399
  if (!result.body) {
460
- throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
400
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
461
401
  }
462
402
  let data: DataCatalogStatus
463
403
  try {
464
404
  data = JSON.parse(result.body)
465
405
  } catch {
466
- throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
406
+ throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
467
407
  }
468
408
  if (data.kind !== DataCatalogKind) {
469
- throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
409
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
470
410
  }
471
411
  return data
472
412
  }