[PSR-3] What about PHP 7 Throwable?

103 views
Skip to first unread message

Julien Falque

unread,
Mar 7, 2018, 8:21:02 AM3/7/18
to PHP Framework Interoperability Group
Hi everyone.

About logging exceptions, PSR-3 says:

If an Exception object is passed in the context data, it MUST be in the 'exception' key. Logging exceptions is a common pattern and this allows implementors to extract a stack trace from the exception when the log backend supports it. Implementors MUST still verify that the 'exception' key is actually an Exception before using it as such, as it MAY contain anything. (https://www.php-fig.org/psr/psr-3/#13-context)

When this was published, PHP 7 wasn't released and Throwable interface didn't exist. I have several questions about this.

Should Throwable be taken into account?

If so, should we update PSR-3 or is it better to write a new PSR (like with PSR-12 for PSR-2)?

Do we want to keep using 'exception' as key? Should we use 'error'? 'throwable'? All of them?

Thanks.
Message has been deleted

Julien Falque

unread,
Jan 2, 2019, 5:22:45 AM1/2/19
to PHP Framework Interoperability Group
Anyone?

Larry Garfield

unread,
Jan 2, 2019, 8:47:28 AM1/2/19
to php...@googlegroups.com
On Wednesday, January 2, 2019 4:22:11 AM CST Julien Falque wrote:
> Anyone?
If anything, I think an Errata that says "treat any other Throwable the same
as an Exception" is probably the best way forward. No need for a whole new
PSR just for that.

--Larry Garfield
signature.asc
Reply all
Reply to author
Forward
0 new messages