Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception class not found #9

Open
SomebodyInTheWorld1 opened this issue Jan 11, 2022 · 0 comments
Open

Exception class not found #9

SomebodyInTheWorld1 opened this issue Jan 11, 2022 · 0 comments

Comments

@SomebodyInTheWorld1
Copy link

I might be mistaking but I'm trying to do:


require 'vendor/autoload.php';

use OpenNode\Merchant\Charge;
use OpenNode\OpenNode;
use OpenNode\Exception;

OpenNode::config(array(
           'environment'               => 'dev', // dev OR live
           'auth_token'                => 'mykey',
           'curlopt_ssl_verifypeer'    => false // default is false
       ));

try {
    $order = Charge::find('c1cddabe-c27b-44a6-91e8-a8f3553dc5c7');
    var_dump($order);
} catch (Exception $e) {
    var_dump($e->getMessage());
}

And I get this error. Maybe autoloading should be fixed or exceptions should be split in more classes

  | <b>Fatal error</b>:  Uncaught Error: Class &quot;OpenNode\NotFound&quot; not found in C:\xampp\htdocs\temp\vendor\opennode\opennode-php\lib\Exception.php:32
  | Stack trace:
  | #0 C:\xampp\htdocs\temp\vendor\opennode\opennode-php\lib\OpenNode.php(91): OpenNode\Exception::throwException(404, Array)
  | #1 C:\xampp\htdocs\temp\vendor\opennode\opennode-php\lib\Merchant\Charge.php(40): OpenNode\OpenNode::request('https://dev-api...', 'GET', Array, Array)
  | #2 C:\xampp\htdocs\temp\vendor\opennode\opennode-php\lib\Merchant\Charge.php(32): OpenNode\Merchant\Charge::findOrFail('c1cddabe-c27b-4...', Array, Array)
  | #3 C:\xampp\htdocs\temp\index.php(16): OpenNode\Merchant\Charge::find('c1cddabe-c27b-4...')
  | #4 {main}
  | thrown in <b>C:\xampp\htdocs\temp\vendor\opennode\opennode-php\lib\Exception.php</b> on line <b>32</b><br />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant