Skip to content

Add specific type Errors #6

@AndreasBackx

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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