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
-[`logDrainsCreateLogDrain`](docs/sdks/logdrains/README.md#createlogdrain) - Creates a new Integration Log Drain
629
625
-[`logDrainsDeleteConfigurableLogDrain`](docs/sdks/logdrains/README.md#deleteconfigurablelogdrain) - Deletes a Configurable Log Drain
630
626
-[`logDrainsDeleteIntegrationLogDrain`](docs/sdks/logdrains/README.md#deleteintegrationlogdrain) - Deletes the Integration log drain with the provided `id`
@@ -634,6 +630,7 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
634
630
-[`marketplaceCreateInstallationIntegrationConfiguration`](docs/sdks/marketplace/README.md#createinstallationintegrationconfiguration) - Create one or multiple experimentation items
635
631
-[`marketplaceCreateInstallationIntegrationEdgeConfig`](docs/sdks/marketplace/README.md#createinstallationintegrationedgeconfig) - Get the data of a user-provided Edge Config
636
632
-[`marketplaceDeleteInstallationIntegrationConfiguration`](docs/sdks/marketplace/README.md#deleteinstallationintegrationconfiguration) - Delete an existing experimentation item
-[`marketplaceGetAccountInfo`](docs/sdks/marketplace/README.md#getaccountinfo) - Get Account Information
639
636
-[`marketplaceGetInvoice`](docs/sdks/marketplace/README.md#getinvoice) - Get Invoice
@@ -744,7 +741,6 @@ async function run() {
744
741
requestBody: awaitopenAsBlob("example.file"),
745
742
});
746
743
747
-
// Handle the result
748
744
console.log(result);
749
745
}
750
746
@@ -782,7 +778,6 @@ async function run() {
782
778
},
783
779
});
784
780
785
-
// Handle the result
786
781
console.log(result);
787
782
}
788
783
@@ -814,7 +809,6 @@ async function run() {
814
809
token: "fdhfr820ad#@FAdlj$$",
815
810
});
816
811
817
-
// Handle the result
818
812
console.log(result);
819
813
}
820
814
@@ -826,65 +820,45 @@ run();
826
820
<!-- Start Error Handling [errors] -->
827
821
## Error Handling
828
822
829
-
Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `postDomains` method may throw the following errors:
823
+
[`VercelError`](./src/models/vercelerror.ts) is the base class for all HTTP error responses. It has the following properties:
// The server response does not match the expected SDK schema
863
-
case (errinstanceofSDKValidationError): {
864
-
// Pretty-print will provide a human-readable multi-line error message
865
-
console.error(err.pretty());
866
-
// Raw value may also be inspected
867
-
console.error(err.rawValue);
868
-
return;
869
-
}
870
-
case (errinstanceofVercelBadRequestError): {
871
-
// Handle err.data$: VercelBadRequestErrorData
872
-
console.error(err);
873
-
return;
874
-
}
875
-
case (errinstanceofVercelForbiddenError): {
876
-
// Handle err.data$: VercelForbiddenErrorData
877
-
console.error(err);
878
-
return;
879
-
}
880
-
case (errinstanceofVercelNotFoundError): {
881
-
// Handle err.data$: VercelNotFoundErrorData
882
-
console.error(err);
883
-
return;
884
-
}
885
-
default: {
886
-
// Other errors such as network errors, see HTTPClientErrors for more details
887
-
throwerr;
851
+
} catch (error) {
852
+
// The base class for HTTP error responses
853
+
if (errorinstanceofVercelError) {
854
+
console.log(error.message);
855
+
console.log(error.statusCode);
856
+
console.log(error.body);
857
+
console.log(error.headers);
858
+
859
+
// Depending on the method different errors may be thrown
860
+
if (errorinstanceofVercelBadRequestError) {
861
+
console.log(error.data$.error); // models.ErrorT
888
862
}
889
863
}
890
864
}
@@ -894,17 +868,32 @@ run();
894
868
895
869
```
896
870
897
-
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.
871
+
### Error Classes
872
+
**Primary errors:**
873
+
*[`VercelError`](./src/models/vercelerror.ts): The base class for HTTP error responses.
874
+
*[`VercelBadRequestError`](docs/models/vercelbadrequesterror.md): Status code `400`. *
875
+
*[`VercelForbiddenError`](docs/models/vercelforbiddenerror.md): Status code `401`. *
876
+
877
+
<details><summary>Less common errors (8)</summary>
898
878
899
-
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/httpclienterrors.ts` module:
879
+
<br />
880
+
881
+
**Network errors:**
882
+
*[`ConnectionError`](./src/models/httpclienterrors.ts): HTTP client was unable to make a request to a server.
883
+
*[`RequestTimeoutError`](./src/models/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
884
+
*[`RequestAbortedError`](./src/models/httpclienterrors.ts): HTTP request was aborted by the client.
885
+
*[`InvalidRequestError`](./src/models/httpclienterrors.ts): Any input used to create a request is invalid.
886
+
*[`UnexpectedClientError`](./src/models/httpclienterrors.ts): Unrecognised or unexpected error.
887
+
888
+
889
+
**Inherit from [`VercelError`](./src/models/vercelerror.ts)**:
890
+
*[`VercelNotFoundError`](docs/models/vercelnotfounderror.md): Status code `404`. Applicable to 93 of 167 methods.*
891
+
*[`VercelRateLimitError`](docs/models/vercelratelimiterror.md): . Status code `429`. Applicable to 1 of 167 methods.*
892
+
*[`ResponseValidationError`](./src/models/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