Skip to content

Standardize exceptions #588

@kynx

Description

@kynx

Currently exceptions thrown by adapters are passed up to the consumer. Other abstraction libraries like flysystem convert exceptions thrown by the adapters to their own, enabling consumers to switch adapters without changing try { ... } catch { ... } blocks.

I'd suggest creating an overall ExceptionInterface to identify exceptions coming from this library, then broad classes of exceptions with codes matching the HTTP status. Something like:

  • ClientException - ie a 400 error; the current DocumentNotFoundException could extend it
  • ServerException - 500, 504, etc

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions