Skip to content

Exception is thrown when incorrect API details are provided. #8

@elliott-stocks

Description

@elliott-stocks

If API details are incorrect an exception is thrown (GoCardless_ApiException), and the user is unable to change the settings without manually going into the database.

Proposed solution:

try {
    // Initialize library
    GoCardless::set_account_details(array(
      'app_id'        => $gocardless_config['app_id'],
      'app_secret'    => $gocardless_config['app_secret'],
      'merchant_id'   => $gocardless_config['merchant_id'],
      'access_token'  => $gocardless_config['access_token'],
      'ua_tag'        => 'gocardless-wp/v' . GC_WP_VERSION
    ));
} catch (GoCardless_ApiException $e) {
    echo 'API details are incorrect, please check and try again (see error below)';
    echo $e->getMessage();
} 

However this solution still doesn't catch the exception, maybe something in the GoCardless library handling exceptions? I'm not too sure as I'm not too familiar with exceptions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions