-
Notifications
You must be signed in to change notification settings - Fork 4
Agregar propiedad "Status" a objeto de error #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Agregar propiedad "Status" a objeto de error #40
Conversation
javorosas
commented
Dec 10, 2025
- Se agrega propiedad "Status" al objeto de error
- Se centraliza el manejo de errores en método compartido en BaseWrapper
- Se eliminan "using"s innecesarios
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves error handling in the Facturapi .NET SDK by adding a "Status" property to the FacturapiException class and centralizing error handling logic in the BaseWrapper class through a new ThrowIfErrorAsync method. This refactoring eliminates code duplication across all wrapper classes.
- Adds a
Statusproperty toFacturapiExceptionto expose HTTP status codes from API errors - Introduces centralized error handling through
BaseWrapper.ThrowIfErrorAsyncandCreateExceptionmethods - Removes duplicated error handling code from all wrapper classes, replacing it with calls to the shared method
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| FacturAPIException.cs | Adds Status property and updates constructor to accept optional status parameter |
| Wrappers/BaseWrapper.cs | Introduces CreateException and ThrowIfErrorAsync methods to centralize error handling logic |
| Wrappers/WebhookWrapper.cs | Replaces inline error handling with ThrowIfErrorAsync calls; removes unused imports |
| Wrappers/ToolWrapper.cs | Replaces inline error handling with ThrowIfErrorAsync calls; removes unused imports |
| Wrappers/RetentionWrapper.cs | Replaces inline error handling with ThrowIfErrorAsync calls; removes unused imports |
| Wrappers/ReceiptWrapper.cs | Replaces inline error handling with ThrowIfErrorAsync calls; removes unused imports |
| Wrappers/ProductWrapper.cs | Replaces inline error handling with ThrowIfErrorAsync calls; removes unused imports |
| Wrappers/OrganizationWrapper.cs | Replaces inline error handling with ThrowIfErrorAsync calls; removes unused imports; fixes indentation |
| Wrappers/InvoiceWrapper.cs | Replaces inline error handling with ThrowIfErrorAsync calls; removes unused imports |
| Wrappers/CustomerWrapper.cs | Replaces inline error handling with ThrowIfErrorAsync calls; removes unused imports; fixes indentation |
| Wrappers/CatalogWrapper.cs | Replaces inline error handling with ThrowIfErrorAsync calls; removes unused imports |
Comments suppressed due to low confidence (1)
Wrappers/BaseWrapper.cs:43
- Poor error handling: empty catch block.
catch (JsonException)
{
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…wing - Updated `FacturapiException` to include an optional status code. - Introduced `ThrowIfErrorAsync` method in `BaseWrapper` to handle HTTP response errors consistently across all wrappers. - Removed redundant error handling code from `CatalogWrapper`, `CustomerWrapper`, `InvoiceWrapper`, `OrganizationWrapper`, `ProductWrapper`, `ReceiptWrapper`, `RetentionWrapper`, `ToolWrapper`, and `WebhookWrapper`. - Ensured all wrappers now utilize the new error handling method for improved maintainability and readability.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…archCatalogAsync for error handling and response parsing
fcee372 to
aa21682
Compare