Skip to content

Commit

Permalink
Allow mixed for exception codes, because PDO
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Jun 28, 2017
1 parent 6b2f5cd commit 77de098
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
14 changes: 9 additions & 5 deletions lib/PanicError.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ class PanicError extends \Error {
/**
* Creates a new panic error.
*
* @param string $name The uncaught exception class.
* @param string $name The uncaught exception class.
* @param string $message The panic message.
* @param int $code The panic code.
* @param string $trace The panic stack trace.
* @param mixed $code The panic code.
* @param string $trace The panic stack trace.
*/
public function __construct(string $name, string $message = '', int $code = 0, string $trace = '') {
parent::__construct($message, $code);
public function __construct(string $name, string $message = '', $code = 0, string $trace = '') {
parent::__construct($message);

// Code might also be a string, because PDO, so don't pass to parent constructor, but assign directly.
// See https://github.com/amphp/parallel/issues/19.
$this->code = $code;
$this->name = $name;
$this->trace = $trace;
}
Expand Down
14 changes: 9 additions & 5 deletions lib/Worker/TaskError.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ class TaskError extends \Error {
private $trace;

/**
* @param string $name The exception class name.
* @param string $name The exception class name.
* @param string $message The panic message.
* @param int $code The panic code.
* @param string $trace The panic stack trace.
* @param mixed $code The panic code.
* @param string $trace The panic stack trace.
*/
public function __construct(string $name, string $message = '', int $code = 0, string $trace = '') {
parent::__construct($message, $code);
public function __construct(string $name, string $message = '', $code = 0, string $trace = '') {
parent::__construct($message);

// Code might also be a string, because PDO, so don't pass to parent constructor, but assign directly.
// See https://github.com/amphp/parallel/issues/19.
$this->code = $code;
$this->name = $name;
$this->trace = $trace;
}
Expand Down
14 changes: 9 additions & 5 deletions lib/Worker/TaskException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ class TaskException extends \Exception {
private $trace;

/**
* @param string $name The exception class name.
* @param string $name The exception class name.
* @param string $message The panic message.
* @param int $code The panic code.
* @param string $trace The panic stack trace.
* @param mixed $code The panic code.
* @param string $trace The panic stack trace.
*/
public function __construct(string $name, string $message = '', int $code = 0, string $trace = '') {
parent::__construct($message, $code);
public function __construct(string $name, string $message = '', $code = 0, string $trace = '') {
parent::__construct($message);

// Code might also be a string, because PDO, so don't pass to parent constructor, but assign directly.
// See https://github.com/amphp/parallel/issues/19.
$this->code = $code;
$this->name = $name;
$this->trace = $trace;
}
Expand Down

0 comments on commit 77de098

Please sign in to comment.