You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| RequestAbortedError | HTTP request was aborted by the client |
392
-
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
393
-
| ConnectionError | HTTP client was unable to make a request to a server |
394
-
| InvalidRequestError | Any input used to create a request is invalid |
395
-
| UnexpectedClientError | Unrecognised or unexpected error |
396
-
397
-
In addition, when custom error responses are specified for an operation, the SDK may throw their associated Error type. You can refer to respective *Errors* tables in SDK docs for more details on possible error types for each operation. For example, the `deleteAccount` method may throw the following errors:
384
+
If the request fails due to, for example 4XX or 5XX status codes, it will throw a `SDKError`.
398
385
399
386
| Error Type | Status Code | Content Type |
400
387
| --------------- | ----------- | ------------ |
@@ -422,14 +409,24 @@ async function run() {
422
409
console.log(result);
423
410
} catch (err) {
424
411
switch (true) {
425
-
case (errinstanceofSDKValidationError): {
426
-
// Validation errors can be pretty-printed
427
-
console.error(err.pretty());
428
-
// Raw value may also be inspected
429
-
console.error(err.rawValue);
412
+
// The server response does not match the expected SDK schema
413
+
case (errinstanceofSDKValidationError):
414
+
{
415
+
// Pretty-print will provide a human-readable multi-line error message
416
+
console.error(err.pretty());
417
+
// Raw value may also be inspected
418
+
console.error(err.rawValue);
419
+
return;
420
+
}
421
+
sdkerror.js;
422
+
// Server returned an error status code or an unknown content type
423
+
case (errinstanceofSDKError): {
424
+
console.error(err.statusCode);
425
+
console.error(err.rawResponse.body);
430
426
return;
431
427
}
432
428
default: {
429
+
// Other errors such as network errors, see HTTPClientErrors for more details
433
430
throwerr;
434
431
}
435
432
}
@@ -440,7 +437,17 @@ run();
440
437
441
438
```
442
439
443
-
Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted string since validation errors can list many issues and the plain error string may be difficult read when debugging.
440
+
Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
441
+
442
+
In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `sdk/models/errors/httpclienterrors.ts` module:
0 commit comments