Skip to content

fix(dashboard): show actionable error messages instead of raw API errors #448

@betegon

Description

@betegon

Summary

Dashboard commands surface raw API error messages ("API request failed: 404 Not Found") that give users no guidance on what went wrong or what to try next. Other commands in the CLI use ContextError and ResolutionError patterns that provide helpful suggestions.

From #406.

Examples

sentry dashboard list
# Error: API request failed: 404 Not Found
# ^ No guidance — should suggest: sentry dashboard list <org>/

sentry dashboard list nonexistent-org/
# Error: API request failed: 404 Not Found
# ^ Should say: Organization 'nonexistent-org' not found

sentry dashboard view 505818
# Error: API request failed: 403 Forbidden
#   You do not have permission to perform this action.
# ^ Should suggest checking org membership or specifying a different org

Compare with the good error messages already in the CLI:

sentry dashboard view sentry/ 'nonexistent title'
# Error: No dashboard with title 'nonexistent title' found in 'sentry'.
# Available dashboards:
#   226580  1/12/26 Cache Slowdown
#   41406  abhi test dashboard
#   ...

Suggested approach

Wrap the API calls in list.ts and view.ts with error handling that catches ApiError and converts 404/403 responses into ResolutionError or ContextError instances with actionable suggestions:

  • 404 on list/view: "Organization '{org}' not found or has no dashboards. Try: sentry dashboard list <org>/"
  • 403 on view: "No access to dashboard {id}. Try: sentry dashboard view <org>/ {id}"
  • 404 on view with numeric ID: "Dashboard {id} not found in '{org}'. Try: sentry dashboard list <org>/ to see available dashboards"

Key files

  • src/commands/dashboard/list.ts:137-140 — API call with no error handling
  • src/commands/dashboard/view.ts:81-90 — API calls with no error handling
  • src/lib/errors.tsContextError, ResolutionError patterns to follow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions