Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
bug #26959 [Console] Fix PSR exception context key (scaytrase)
This PR was merged into the 3.4 branch.

Discussion
----------

[Console] Fix PSR exception context key

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #26957
| License       | MIT
| Doc PR        | None

Fixes context key according to PSR-3
cc. @xabbuh

Commits
-------

a28393e Fix PSR exception context key
  • Loading branch information
fabpot committed Apr 17, 2018
2 parents 8f2132f + a28393e commit 2a52963
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Console/EventListener/ErrorListener.php
Expand Up @@ -40,10 +40,10 @@ public function onConsoleError(ConsoleErrorEvent $event)
$error = $event->getError();

if (!$inputString = $this->getInputString($event)) {
return $this->logger->error('An error occurred while using the console. Message: "{message}"', array('error' => $error, 'message' => $error->getMessage()));
return $this->logger->error('An error occurred while using the console. Message: "{message}"', array('exception' => $error, 'message' => $error->getMessage()));
}

$this->logger->error('Error thrown while running command "{command}". Message: "{message}"', array('error' => $error, 'command' => $inputString, 'message' => $error->getMessage()));
$this->logger->error('Error thrown while running command "{command}". Message: "{message}"', array('exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()));
}

public function onConsoleTerminate(ConsoleTerminateEvent $event)
Expand Down
Expand Up @@ -34,7 +34,7 @@ public function testOnConsoleError()
$logger
->expects($this->once())
->method('error')
->with('Error thrown while running command "{command}". Message: "{message}"', array('error' => $error, 'command' => 'test:run --foo=baz buzz', 'message' => 'An error occurred'))
->with('Error thrown while running command "{command}". Message: "{message}"', array('exception' => $error, 'command' => 'test:run --foo=baz buzz', 'message' => 'An error occurred'))
;

$listener = new ErrorListener($logger);
Expand All @@ -49,7 +49,7 @@ public function testOnConsoleErrorWithNoCommandAndNoInputString()
$logger
->expects($this->once())
->method('error')
->with('An error occurred while using the console. Message: "{message}"', array('error' => $error, 'message' => 'An error occurred'))
->with('An error occurred while using the console. Message: "{message}"', array('exception' => $error, 'message' => 'An error occurred'))
;

$listener = new ErrorListener($logger);
Expand Down

0 comments on commit 2a52963

Please sign in to comment.