Skip to content

Commit

Permalink
ChannelNotFoundException updated to other exceptions' format without …
Browse files Browse the repository at this point in the history
…BC break (Sylius#9324)

* ChannelNotFoundException updated to other exceptions' format without BC break

* Self-review fixes

* Review fixes
  • Loading branch information
bartoszpietrzak1994 authored and pamil committed Apr 12, 2018
1 parent f4f2406 commit bd09146
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Sylius/Component/Channel/Context/ChannelNotFoundException.php
Expand Up @@ -18,8 +18,19 @@ class ChannelNotFoundException extends \RuntimeException
/**
* {@inheritdoc}
*/
public function __construct(?\Exception $previousException = null)
public function __construct($messageOrPreviousException = null, ?\Throwable $previousException = null)
{
parent::__construct('Channel could not be found! Tip: You can use the Web Debug Toolbar to switch between channels in development.', 0, $previousException);
$message = 'Channel could not be found! Tip: You can use the Web Debug Toolbar to switch between channels in development.';

if ($messageOrPreviousException instanceof \Throwable) {
@trigger_error('Passing previous exception as the first argument is deprecated since 1.2 and will be prohibited since 2.0.', E_USER_DEPRECATED);
$previousException = $messageOrPreviousException;
}

if (is_string($messageOrPreviousException)) {
$message = $messageOrPreviousException;
}

parent::__construct($message, 0, $previousException);
}
}

0 comments on commit bd09146

Please sign in to comment.