@unito/integration-sdk 1.0.24 → 1.0.26
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.
package/dist/src/index.cjs
CHANGED
|
@@ -1305,8 +1305,9 @@ class Provider {
|
|
|
1305
1305
|
case 'TimeoutError':
|
|
1306
1306
|
throw this.handleError(408, 'Request timeout');
|
|
1307
1307
|
}
|
|
1308
|
+
throw this.handleError(500, `Unexpected error while calling the provider: name: "${error.name}" \n message: "${error.message}" \n stack: ${error.stack}`);
|
|
1308
1309
|
}
|
|
1309
|
-
throw this.handleError(500,
|
|
1310
|
+
throw this.handleError(500, 'Unexpected error while calling the provider - this is not normal, investigate');
|
|
1310
1311
|
}
|
|
1311
1312
|
if (response.status >= 400) {
|
|
1312
1313
|
const textResult = await response.text();
|
|
@@ -1335,7 +1336,7 @@ class Provider {
|
|
|
1335
1336
|
body = response.body;
|
|
1336
1337
|
}
|
|
1337
1338
|
else {
|
|
1338
|
-
throw this.handleError(500, 'Unsupported
|
|
1339
|
+
throw this.handleError(500, 'Unsupported Content-Type');
|
|
1339
1340
|
}
|
|
1340
1341
|
return { status: response.status, headers: response.headers, body };
|
|
1341
1342
|
};
|
|
@@ -266,8 +266,9 @@ export class Provider {
|
|
|
266
266
|
case 'TimeoutError':
|
|
267
267
|
throw this.handleError(408, 'Request timeout');
|
|
268
268
|
}
|
|
269
|
+
throw this.handleError(500, `Unexpected error while calling the provider: name: "${error.name}" \n message: "${error.message}" \n stack: ${error.stack}`);
|
|
269
270
|
}
|
|
270
|
-
throw this.handleError(500,
|
|
271
|
+
throw this.handleError(500, 'Unexpected error while calling the provider - this is not normal, investigate');
|
|
271
272
|
}
|
|
272
273
|
if (response.status >= 400) {
|
|
273
274
|
const textResult = await response.text();
|
|
@@ -296,7 +297,7 @@ export class Provider {
|
|
|
296
297
|
body = response.body;
|
|
297
298
|
}
|
|
298
299
|
else {
|
|
299
|
-
throw this.handleError(500, 'Unsupported
|
|
300
|
+
throw this.handleError(500, 'Unsupported Content-Type');
|
|
300
301
|
}
|
|
301
302
|
return { status: response.status, headers: response.headers, body };
|
|
302
303
|
};
|
|
@@ -478,7 +478,10 @@ describe('Provider', () => {
|
|
|
478
478
|
error = e;
|
|
479
479
|
}
|
|
480
480
|
assert.ok(error instanceof HttpErrors.HttpError);
|
|
481
|
-
assert.
|
|
481
|
+
assert.ok(error.message.startsWith('Unexpected error while calling the provider:'));
|
|
482
|
+
assert.ok(error.message.includes('name: "Error"'));
|
|
483
|
+
assert.ok(error.message.includes('message: "foo"'));
|
|
484
|
+
assert.ok(error.message.includes('stack:'));
|
|
482
485
|
});
|
|
483
486
|
it('throws on status 429', async (context) => {
|
|
484
487
|
const response = new Response('response body', {
|
package/package.json
CHANGED
|
@@ -357,9 +357,13 @@ export class Provider {
|
|
|
357
357
|
case 'TimeoutError':
|
|
358
358
|
throw this.handleError(408, 'Request timeout');
|
|
359
359
|
}
|
|
360
|
+
throw this.handleError(
|
|
361
|
+
500,
|
|
362
|
+
`Unexpected error while calling the provider: name: "${error.name}" \n message: "${error.message}" \n stack: ${error.stack}`,
|
|
363
|
+
);
|
|
360
364
|
}
|
|
361
365
|
|
|
362
|
-
throw this.handleError(500,
|
|
366
|
+
throw this.handleError(500, 'Unexpected error while calling the provider - this is not normal, investigate');
|
|
363
367
|
}
|
|
364
368
|
|
|
365
369
|
if (response.status >= 400) {
|
|
@@ -392,7 +396,7 @@ export class Provider {
|
|
|
392
396
|
// When we expect octet-stream, we accept any Content-Type the provider sends us, we just want to stream it.
|
|
393
397
|
body = response.body as T;
|
|
394
398
|
} else {
|
|
395
|
-
throw this.handleError(500, 'Unsupported
|
|
399
|
+
throw this.handleError(500, 'Unsupported Content-Type');
|
|
396
400
|
}
|
|
397
401
|
|
|
398
402
|
return { status: response.status, headers: response.headers, body };
|
|
@@ -569,7 +569,10 @@ describe('Provider', () => {
|
|
|
569
569
|
}
|
|
570
570
|
|
|
571
571
|
assert.ok(error instanceof HttpErrors.HttpError);
|
|
572
|
-
assert.
|
|
572
|
+
assert.ok(error.message.startsWith('Unexpected error while calling the provider:'));
|
|
573
|
+
assert.ok(error.message.includes('name: "Error"'));
|
|
574
|
+
assert.ok(error.message.includes('message: "foo"'));
|
|
575
|
+
assert.ok(error.message.includes('stack:'));
|
|
573
576
|
});
|
|
574
577
|
|
|
575
578
|
it('throws on status 429', async context => {
|