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
-------
a28393e482
Fix PSR exception context key
This commit is contained in:
commit
2a529633f5
@ -40,10 +40,10 @@ class ErrorListener implements EventSubscriberInterface
|
|||||||
$error = $event->getError();
|
$error = $event->getError();
|
||||||
|
|
||||||
if (!$inputString = $this->getInputString($event)) {
|
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)
|
public function onConsoleTerminate(ConsoleTerminateEvent $event)
|
||||||
|
@ -34,7 +34,7 @@ class ErrorListenerTest extends TestCase
|
|||||||
$logger
|
$logger
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('error')
|
->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);
|
$listener = new ErrorListener($logger);
|
||||||
@ -49,7 +49,7 @@ class ErrorListenerTest extends TestCase
|
|||||||
$logger
|
$logger
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('error')
|
->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);
|
$listener = new ErrorListener($logger);
|
||||||
|
Reference in New Issue
Block a user