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: NUGET.md
+49-43Lines changed: 49 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -247,26 +247,15 @@ while(res != null)
247
247
<!-- Start Error Handling [errors] -->
248
248
## Error Handling
249
249
250
-
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.
251
-
252
-
By default, an API error will raise a `ApideckUnifySdk.Models.Errors.APIException` exception, which has the following properties:
250
+
[`ApideckError`](./src/ApideckUnifySdk/Models/Errors/ApideckError.cs) is the base exception class for all HTTP error responses. It has the following properties:
|`Request`|*HttpRequestMessage*| The HTTP request |
258
-
|`Response`|*HttpResponseMessage*| The HTTP response |
259
-
260
-
When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `ListAsync` method throws the following exceptions:
Some exceptions in this SDK include an additional `Payload` field, which will contain deserialized custom error data when present. Possible exceptions are listed in the [Error Classes](#error-classes) section.
270
259
271
260
### Example
272
261
@@ -309,40 +298,57 @@ try
309
298
res=awaitres.Next!();
310
299
}
311
300
}
312
-
catch (Exceptionex)
301
+
catch (ApideckErrorex)// all SDK exceptions inherit from ApideckError
313
302
{
314
-
if (exisBadRequestResponse)
315
-
{
316
-
// Handle exception data
317
-
throw;
318
-
}
319
-
elseif (exisUnauthorizedResponse)
320
-
{
321
-
// Handle exception data
322
-
throw;
323
-
}
324
-
elseif (exisPaymentRequiredResponse)
325
-
{
326
-
// Handle exception data
327
-
throw;
328
-
}
329
-
elseif (exisNotFoundResponse)
330
-
{
331
-
// Handle exception data
332
-
throw;
333
-
}
334
-
elseif (exisUnprocessableResponse)
303
+
// ex.ToString() provides a detailed error message
304
+
System.Console.WriteLine(ex);
305
+
306
+
// Base exception fields
307
+
HttpRequestMessagerequest=ex.Request;
308
+
HttpResponseMessageresponse=ex.Response;
309
+
varstatusCode= (int)response.StatusCode;
310
+
varresponseBody=ex.Body;
311
+
312
+
if (exisBadRequestResponse) // different exceptions may be thrown depending on the method
// Check ex.InnerException for Network connectivity errors
330
+
}
345
331
```
332
+
333
+
### Error Classes
334
+
335
+
**Primary exceptions:**
336
+
*[`ApideckError`](./src/ApideckUnifySdk/Models/Errors/ApideckError.cs): The base class for HTTP error responses.
337
+
*[`UnauthorizedResponse`](./src/ApideckUnifySdk/Models/Errors/UnauthorizedResponse.cs): Unauthorized. Status code `401`.
338
+
*[`PaymentRequiredResponse`](./src/ApideckUnifySdk/Models/Errors/PaymentRequiredResponse.cs): Payment Required. Status code `402`.
339
+
*[`NotFoundResponse`](./src/ApideckUnifySdk/Models/Errors/NotFoundResponse.cs): The specified resource was not found. Status code `404`. *
340
+
*[`BadRequestResponse`](./src/ApideckUnifySdk/Models/Errors/BadRequestResponse.cs): Bad Request. Status code `400`. *
341
+
*[`UnprocessableResponse`](./src/ApideckUnifySdk/Models/Errors/UnprocessableResponse.cs): Unprocessable. Status code `422`. *
342
+
343
+
<details><summary>Less common exceptions (2)</summary>
344
+
345
+
*[`System.Net.Http.HttpRequestException`](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httprequestexception): Network connectivity error. For more details about the underlying cause, inspect the `ex.InnerException`.
346
+
347
+
* Inheriting from [`ApideckError`](./src/ApideckUnifySdk/Models/Errors/ApideckError.cs):
348
+
*[`ResponseValidationError`](./src/ApideckUnifySdk/Models/Errors/ResponseValidationError.cs): Thrown when the response data could not be deserialized into the expected type.
349
+
</details>
350
+
351
+
\* Refer to the [relevant documentation](#available-resources-and-operations) to determine whether an exception applies to a specific operation.
*[List](docs/sdks/connectioncustommappings/README.md#list) - List connection custom mappings
@@ -878,26 +886,15 @@ while(res != null)
878
886
<!-- Start Error Handling [errors] -->
879
887
## Error Handling
880
888
881
-
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.
882
-
883
-
By default, an API error will raise a `ApideckUnifySdk.Models.Errors.APIException` exception, which has the following properties:
889
+
[`ApideckError`](./src/ApideckUnifySdk/Models/Errors/ApideckError.cs) is the base exception class for all HTTP error responses. It has the following properties:
|`Request`|*HttpRequestMessage*| The HTTP request |
889
-
|`Response`|*HttpResponseMessage*| The HTTP response |
890
-
891
-
When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `ListAsync` method throws the following exceptions:
Some exceptions in this SDK include an additional `Payload` field, which will contain deserialized custom error data when present. Possible exceptions are listed in the [Error Classes](#error-classes) section.
901
898
902
899
### Example
903
900
@@ -940,40 +937,57 @@ try
940
937
res=awaitres.Next!();
941
938
}
942
939
}
943
-
catch (Exceptionex)
940
+
catch (ApideckErrorex)// all SDK exceptions inherit from ApideckError
944
941
{
945
-
if (exisBadRequestResponse)
946
-
{
947
-
// Handle exception data
948
-
throw;
949
-
}
950
-
elseif (exisUnauthorizedResponse)
951
-
{
952
-
// Handle exception data
953
-
throw;
954
-
}
955
-
elseif (exisPaymentRequiredResponse)
956
-
{
957
-
// Handle exception data
958
-
throw;
959
-
}
960
-
elseif (exisNotFoundResponse)
961
-
{
962
-
// Handle exception data
963
-
throw;
964
-
}
965
-
elseif (exisUnprocessableResponse)
942
+
// ex.ToString() provides a detailed error message
943
+
System.Console.WriteLine(ex);
944
+
945
+
// Base exception fields
946
+
HttpRequestMessagerequest=ex.Request;
947
+
HttpResponseMessageresponse=ex.Response;
948
+
varstatusCode= (int)response.StatusCode;
949
+
varresponseBody=ex.Body;
950
+
951
+
if (exisBadRequestResponse) // different exceptions may be thrown depending on the method
// Check ex.InnerException for Network connectivity errors
969
+
}
976
970
```
971
+
972
+
### Error Classes
973
+
974
+
**Primary exceptions:**
975
+
*[`ApideckError`](./src/ApideckUnifySdk/Models/Errors/ApideckError.cs): The base class for HTTP error responses.
976
+
*[`UnauthorizedResponse`](./src/ApideckUnifySdk/Models/Errors/UnauthorizedResponse.cs): Unauthorized. Status code `401`.
977
+
*[`PaymentRequiredResponse`](./src/ApideckUnifySdk/Models/Errors/PaymentRequiredResponse.cs): Payment Required. Status code `402`.
978
+
*[`NotFoundResponse`](./src/ApideckUnifySdk/Models/Errors/NotFoundResponse.cs): The specified resource was not found. Status code `404`. *
979
+
*[`BadRequestResponse`](./src/ApideckUnifySdk/Models/Errors/BadRequestResponse.cs): Bad Request. Status code `400`. *
980
+
*[`UnprocessableResponse`](./src/ApideckUnifySdk/Models/Errors/UnprocessableResponse.cs): Unprocessable. Status code `422`. *
981
+
982
+
<details><summary>Less common exceptions (2)</summary>
983
+
984
+
*[`System.Net.Http.HttpRequestException`](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httprequestexception): Network connectivity error. For more details about the underlying cause, inspect the `ex.InnerException`.
985
+
986
+
* Inheriting from [`ApideckError`](./src/ApideckUnifySdk/Models/Errors/ApideckError.cs):
987
+
*[`ResponseValidationError`](./src/ApideckUnifySdk/Models/Errors/ResponseValidationError.cs): Thrown when the response data could not be deserialized into the expected type.
988
+
</details>
989
+
990
+
\* Refer to the [relevant documentation](#available-resources-and-operations) to determine whether an exception applies to a specific operation.
|`CustomMappings`| Dictionary<String, *object*> |:heavy_minus_sign:| When custom mappings are configured on the resource, the result is included here. ||
25
25
|`TrackingCategoriesEnabled`|*bool*|:heavy_minus_sign:| Whether tracking categories are enabled for the company on transactions ||
26
+
|`TrackingCategoriesMode`|[TrackingCategoriesMode](../../Models/Components/TrackingCategoriesMode.md)|:heavy_minus_sign:| The mode of tracking categories for the company on transactions | disabled |
26
27
|`RowVersion`|*string*|:heavy_minus_sign:| A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. | 1-12345 |
27
28
|`UpdatedBy`|*string*|:heavy_minus_sign:| The user who last updated the object. | 12345 |
28
29
|`CreatedBy`|*string*|:heavy_minus_sign:| The user who created the object. | 12345 |
0 commit comments