Skip to content

Add specific type Errors #6

Description

@AndreasBackx

The API documentation has a ton of errors listed, would it be possible to have these exact errors/exceptions be raised by the library? Currently we have to check for the errors inside of the Error's error (that sentence is a bit ridiculous, but it makes it clear).

We end up with the following constantly:

try:
    instance.from_api(
        instance.api.create,
        params=given
    )
except GoCardlessProError as e:
    raise DjangoGoCardlessException.from_gocardless_exception(e)
instance.save(*args, **kwargs)

The DjangoGoCardlessException.from_gocardless_exception(e) would raise the exception that should've been raised by the library.

Instead of that something like this:

try:
    instance.from_api(
        instance.api.create,
        params=given
    )
except AccessTokenNotFound as e:
    # Perhaps not catch it here, but elsewhere.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions