Page MenuHomeDevCentral

Explicitely log exception message
ClosedPublic

Authored by dereckson on Dec 30 2016, 02:11.
Tags
None
Referenced Files
F27627574: D778.id1970.diff
Wed, May 6, 03:53
F27619059: D778.id1968.diff
Wed, May 6, 01:19
F27609595: D778.id1969.diff
Tue, May 5, 22:24
F27607065: D778.id1969.diff
Tue, May 5, 21:34
F27607058: D778.id1970.diff
Tue, May 5, 21:34
F27606981: D778.diff
Tue, May 5, 21:32
Unknown Object (File)
Mon, May 4, 12:29
Unknown Object (File)
Mon, May 4, 11:48
Subscribers

Details

Summary

The notifications center logs exceptions thrown's messages,
and to do so pass the exception to the log method.

As this method wants a string as parameter, it was converted as string.
But as we plan to use declare(strict_types=1), such implicit conver-
sion isn't welcome.

Fixes the following issue detected by phan:

app/Exceptions/Handler.php:49
PhanTypeMismatchArgument
Argument 1 (message) is \Exception|\Throwable but
\Psr\Log\LoggerInterface::error() takes string defined at
vendor/psr/log/Psr/Log/LoggerInterface.php:66
Test Plan

phan | grep PhanTypeMismatchArgument

Diff Detail

Repository
rNOTIF Notifications center
Lint
Lint Passed
Unit
Tests Passed
Branch
explicit-string-type (branched from master)

Event Timeline

dereckson edited edge metadata.

Call magic method instead of only the message.

dereckson added inline comments.
app/Exceptions/Handler.php
49

http://php.net/manual/en/exception.tostring.php

We're losing information here.

(string)$e or $e->__toString() would allow to keep it.

dereckson requested a review of this revision.
dereckson edited edge metadata.
dereckson marked an inline comment as done.
This revision is now accepted and ready to land.Dec 30 2016, 02:19
This revision was automatically updated to reflect the committed changes.