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
Copy file name to clipboardExpand all lines: README.md
+43-60Lines changed: 43 additions & 60 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -188,7 +188,6 @@ async function run() {
188
188
],
189
189
});
190
190
191
-
// Handle the result
192
191
console.log(result);
193
192
}
194
193
@@ -234,7 +233,6 @@ async function run() {
234
233
],
235
234
});
236
235
237
-
// Handle the result
238
236
console.log(result);
239
237
}
240
238
@@ -269,7 +267,6 @@ async function run() {
269
267
],
270
268
});
271
269
272
-
// Handle the result
273
270
console.log(result);
274
271
}
275
272
@@ -314,7 +311,6 @@ async function run() {
314
311
],
315
312
});
316
313
317
-
// Handle the result
318
314
console.log(result);
319
315
}
320
316
@@ -430,7 +426,6 @@ async function run() {
430
426
},
431
427
});
432
428
433
-
// Handle the result
434
429
console.log(result);
435
430
}
436
431
@@ -472,7 +467,6 @@ async function run() {
472
467
],
473
468
});
474
469
475
-
// Handle the result
476
470
console.log(result);
477
471
}
478
472
@@ -484,24 +478,21 @@ run();
484
478
<!-- Start Error Handling [errors] -->
485
479
## Error Handling
486
480
487
-
Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `aiVisionGeneral` method may throw the following errors:
481
+
[`CloudinaryAnalysisError`](./src/models/errors/cloudinaryanalysiserror.ts) is the base class for all HTTP error responses. It has the following properties:
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.
539
+
### Error Classes
540
+
**Primary errors:**
541
+
*[`CloudinaryAnalysisError`](./src/models/errors/cloudinaryanalysiserror.ts): The base class for HTTP error responses.
542
+
*[`ErrorResponse`](docs/models/errors/errorresponse.md): Bad request.
543
+
*[`RateLimitedResponse`](docs/models/errors/ratelimitedresponse.md): Rate limited. Status code `429`.
568
544
569
-
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 `models/errors/httpclienterrors.ts` module:
545
+
<details><summary>Less common errors (6)</summary>
| RequestAbortedError | HTTP request was aborted by the client |
574
-
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
575
-
| ConnectionError | HTTP client was unable to make a request to a server |
576
-
| InvalidRequestError | Any input used to create a request is invalid |
577
-
| UnexpectedClientError | Unrecognised or unexpected error |
547
+
<br />
548
+
549
+
**Network errors:**
550
+
*[`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
551
+
*[`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
552
+
*[`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
553
+
*[`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
554
+
*[`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.
555
+
556
+
557
+
**Inherit from [`CloudinaryAnalysisError`](./src/models/errors/cloudinaryanalysiserror.ts)**:
558
+
*[`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
0 commit comments