Throwable
Introduction
(PHP 7, PHP 8)
Throwable is the base interface for any object that can be thrown via a throw
statement, including Error and Exception.
Note:
PHP classes cannot implement the Throwable interface directly, and must instead extend Exception.
Interface synopsis
Throwable {
/* Methods */
abstract public getMessage ( ) : string
abstract public getCode ( ) : int
abstract public getFile ( ) : string
abstract public getLine ( ) : int
abstract public getTrace ( ) : array
abstract public getTraceAsString ( ) : string
abstract public getPrevious ( ) : Throwable
abstract public __toString ( ) : string}
Table of Contents
- Throwable::getMessage — Gets the message
- Throwable::getCode — Gets the exception code
- Throwable::getFile — Gets the file in which the object was created
- Throwable::getLine — Gets the line on which the object was instantiated
- Throwable::getTrace — Gets the stack trace
- Throwable::getTraceAsString — Gets the stack trace as a string
- Throwable::getPrevious — Returns the previous Throwable
- Throwable::__toString — Gets a string representation of the thrown object
© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.throwable.php