[Domains] Throw an error instead of suppressing#1049
Merged
saeedvaziry merged 4 commits intovitodeploy:3.xfrom Mar 16, 2026
Merged
[Domains] Throw an error instead of suppressing#1049saeedvaziry merged 4 commits intovitodeploy:3.xfrom
saeedvaziry merged 4 commits intovitodeploy:3.xfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR strengthens domain/DNS record workflows by propagating provider errors instead of suppressing them, and by ensuring domain creation is rolled back when initial DNS record sync fails.
Changes:
- Wrap domain creation + initial DNS record sync in a DB transaction and surface sync failures as validation errors.
- Let DNS record sync failures bubble up (Domain model + Cloudflare provider), and handle them in web/API controllers with user-facing errors.
- Update/add feature + unit tests to cover the new failure behaviors.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/Actions/Domain/AddDomain.php | Wraps domain creation + initial record sync in a DB transaction and converts failures into validation errors. |
| app/Models/Domain.php | Removes internal exception suppression in syncDnsRecords() so callers can handle failures. |
| app/DNSProviders/Cloudflare.php | Throws on getRecords() failure instead of returning an empty record set. |
| app/Http/Controllers/DNSRecordController.php | Catches sync exceptions and flashes an error to the user. |
| app/Http/Controllers/API/DNSRecordController.php | Catches sync exceptions and returns an error JSON response. |
| tests/Unit/DNSProviders/CloudflareTest.php | Updates unit expectations for thrown exceptions from getRecords(). |
| tests/Feature/DomainsTest.php | Adds coverage for sync/create failure flows in the web UI. |
| tests/Feature/API/DomainsTest.php | Adds coverage for create-domain rollback behavior in the API. |
| tests/Feature/API/DNSRecordTest.php | Adds coverage for API sync error response when provider fails. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
align with interface
RichardAnderson
added a commit
to RichardAnderson/vito
that referenced
this pull request
Mar 16, 2026
* throw error instead of suppressing * Add error message from generic error * fixes * fix naming issue align with interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves error handling and transactional integrity for domain and DNS record operations. It ensures that failures during DNS record synchronization or domain creation are properly surfaced to the user and that domains are not persisted if DNS record sync fails. The changes also update tests to verify these new behaviors.
Error handling and transactional integrity improvements:
AddDomain.php, ensuring that if DNS record synchronization fails, the domain is not persisted and a validation error is returned to the user. [1] [2]syncDnsRecordsinDomain.phpto remove internal error catching, allowing exceptions to propagate and be handled at a higher level, improving error visibility and rollback behavior. [1] [2]DNSRecordController.php), so that sync failures return user-friendly error messages and appropriate HTTP status codes. [1] [2]DNS provider error propagation:
Cloudflare.phpto throw exceptions when DNS record fetching fails, rather than silently returning empty results, ensuring that upstream errors are properly handled. [1] [2]Testing enhancements:
Test mocking improvements:
These changes collectively make domain and DNS record management more robust, user-friendly, and reliable in the face of external provider failures.