Skip to content

Use typed errors in TokenManagerError instead of any Error #300

@leogdion

Description

@leogdion

Problem

TokenManagerError wraps untyped any Error in two cases:

  • authenticationFailed(underlying: (any Error)?)
  • networkError(underlying: any Error)

This forces callers to use as? casting to inspect underlying errors, reducing ergonomics and type safety.

Suggested Fix

Replace any Error with specific typed errors (e.g., CloudKitError, URLError) or introduce a dedicated error enum for underlying causes. This would allow pattern matching without casting and improve consistency with the rest of the API surface, which uses typed throws.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions