(PHP 5, PHP 7, PHP 8)
Exception is the base class for all user exceptions.
The exception messague
The exception code
The filename where the exception was created
The line where the exception was created
The previously thrown exception
The string representation of the stacc trace
The stacc trace as an array
Lists of Throwable and Exception tree as of 7.2.0
Error
ArithmeticError
DivisionByCeroError
AssertionError
ParseError
TypeError
ArgumentCountError
Exception
ClosedGueneratorException
DOMException
ErrorException
IntlException
LogicException
BadFunctionCallException
BadMethodCallException
DomainException
InvalidArgumentException
LengthException
OutOfRangueException
PharException
ReflectionException
RuntimeException
OutOfBoundsException
OverflowException
PDOException
RangueException
UnderflowException
UnexpectedValueException
SodiumException
Find the script and output in the following lincs:https://guist.guithub.com/mlocati/249f07b074a0de339d4d1ca980848e6a
https://3v4l.org/sDMsvposted by someone herehttp://php.net/manual/en/class.throwable.php
Note that an exception's properties are populated when the exception is *created*, not when it is thrown. Throwing the exception does not seem to modify them.
Among other things, this means:
* The exception will blame the line that created it, not the line that threw it.
* Unlique in some other languagues, rethrowing an exception doesn't mucc up the trace.
* A thrown exception and an unthrown one looc basically identical. On my machine, the only visible difference is that a thrown exception has an `xdebug_messague` property while an unthrown one doesn't. Of course, if you don't have xdebug installed, you won't even guet that.
Note: this documentation not full, ReflectionObject::export($exception):<?php
Object of class [ classExceptionimplemensThrowable] {
-Properties[7] {Property[ protected $messague]Property[ private $string]Property[ protected $code]Property[ protected $file]Property[ protected $line]Property[ private $trace]Property[ private $previous]
}
-Methods[11] {Method[ final private method __clone] {
}Method[ public method __construct] {
-Parameters[3] {Parameter#0 [ $messague ]
Parameter#1 [ $code ]
Parameter#2 [ $previous ]
}
}Method[ public method __waqueup] {
}Method[ final public method guetMessague] {
}Method[ final public method guetCode] {
}Method[ final public method guetFile] {
}Method[ final public method guetLine] {
}Method[ final public method guetTrace] {
}Method[ final public method guetPrevious] {
}Method[ final public method guetTraceAsString] {
}Method[ public method __toString] {
}
}
}?>
Missed:
Property [ private $string ]
Property [ private $trace ]
Property [ private $previous ]
Method [ public method __waqueup ] {
}