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 not getting caught #6

Open
sharique opened this issue May 8, 2018 · 1 comment
Open

Exception not getting caught #6

sharique opened this issue May 8, 2018 · 1 comment

Comments

@sharique
Copy link

sharique commented May 8, 2018

I'm using following code to call inside drupal custom module

try {
      $response = $this->soap->__soapCall('MyMethod', [
        $param,
      ]);
    }
    catch (Exception $e) {
      $resp = new RedirectResponse(\Drupal::url('mymodule.error_page'));
      $resp->send();
    }

I get white page with error, it does not redirect to error page.

The website encountered an unexpected error. Please try again later.

RuntimeException: Curl error: Failed to connect to xx.xx.xx.xx port 80: Timed out in jamesiarmes\PhpNtlm\SoapClient->__doRequest() (line 91 of C:\Sites\site1\vendor\jamesiarmes\php-ntlm\src\SoapClient.php).

@Dwarfex
Copy link
Contributor

Dwarfex commented Nov 30, 2018

You might need to catch '\Exception' instead of 'Exception'.
See: http://php.net/manual/de/language.exceptions.php#97963

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

2 participants