-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce OpenSSLException that will automatically concat the entire …
…error-stack
- Loading branch information
Showing
5 changed files
with
50 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\XMLSecurity\Exception; | ||
|
||
/** | ||
* Class OpenSSLException | ||
* | ||
* This exception is thrown when an error occurs during a call to the openssl backend. | ||
* | ||
* @package simplesamlphp/xml-security | ||
*/ | ||
class OpenSSLException extends RuntimeException | ||
{ | ||
/** | ||
* @param string $message | ||
*/ | ||
public function __construct(string $message = 'Generic OpenSSL exception') | ||
{ | ||
$stack = []; | ||
while (($msg = openssl_error_string()) !== false) { | ||
$stack[] = $msg; | ||
} | ||
|
||
foreach ($stack as $line) { | ||
$message .= '; ' . $line; | ||
} | ||
$message .= '.'; | ||
|
||
parent::__construct($message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters