Skip to content

fix: improve resolver error messages with specific failure context#37

Open
JoshSalway wants to merge 1 commit intolaravel:mainfrom
JoshSalway:fix/resolver-error-messages
Open

fix: improve resolver error messages with specific failure context#37
JoshSalway wants to merge 1 commit intolaravel:mainfrom
JoshSalway:fix/resolver-error-messages

Conversation

@JoshSalway
Copy link

Summary

  • Replace generic "Unable to resolve X" error messages across all 16 resolvers with specific, actionable messages that distinguish between: ID not found, name not found, no identifier provided, and (for ApplicationResolver) repository not matched
  • Improve the base Resolver::resolveFromIdentifier() to catch Saloon\Exceptions\Request\RequestException specifically — 404s fall through to name-based lookup, while 403 (permission) and other HTTP errors are re-thrown with context instead of being silently swallowed
  • Add looksLikeId() helper to the base Resolver, reused by all subclasses to tailor error messages based on whether the user provided an ID or a name

Before

Unable to resolve application: my-app
Unable to resolve environment: env-abc123

After

No application named 'my-app' found in your organization.
Environment 'env-abc123' not found. Verify the ID is correct and belongs to your application.
No application found matching repository 'user/repo'. Create one or provide an application ID or name as an argument.

Closes #30

Test plan

  • All existing tests pass (./vendor/bin/pest — 31 passed)
  • PHPStan analysis passes with no errors on app/Resolvers/
  • Manual: run cloud app:info bad-name and verify "No application named 'bad-name' found" message
  • Manual: run cloud app:info app-nonexistent123 and verify "Application 'app-nonexistent123' not found" message
  • Manual: run cloud env:info from a non-linked repo and verify repo-specific or generic fallback message

🤖 Generated with Claude Code

Replace generic "Unable to resolve X" messages across all resolvers with
distinct errors that tell the user exactly what went wrong: ID not found,
name not found, repo not matched, or no identifier provided. Also improve
the base Resolver to distinguish API 404s from permission errors (403)
and other HTTP failures, re-throwing non-404 errors instead of silently
swallowing them.

Closes laravel#30

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JoshSalway JoshSalway changed the title Improve resolver error messages with specific failure context fix: improve resolver error messages with specific failure context Mar 16, 2026
@JoshSalway

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolver error messages don't distinguish failure reasons

1 participant