interface Exception implements Throwable (View source)

Common interface for all driver exceptions. This may be used to catch only exceptions originating from the driver itself.

Methods

string
__toString()

Magic method {https://www.php.net/manual/en/language.oop5.magic.php#object.tostring} allows a class to decide how it will react when it is treated like a string.

string
getMessage()

Gets the message

int
getCode()

Gets the exception code

string
getFile()

Gets the file in which the exception occurred

int
getLine()

Gets the line on which the object was instantiated

array
getTrace()

Gets the stack trace

string
getTraceAsString()

Gets the stack trace as a string

null|Throwable
getPrevious()

Returns the previous Throwable

Details

string __toString()

Magic method {https://www.php.net/manual/en/language.oop5.magic.php#object.tostring} allows a class to decide how it will react when it is treated like a string.

Return Value

string

Returns string representation of the object that implements this interface (and/or "__toString" magic method).

string getMessage()

Since: 7.0

Gets the message

Return Value

string

int getCode()

Since: 7.0

Gets the exception code

Return Value

int

Returns the exception code as integer in {\Exception} but possibly as other type in {\Exception} descendants (for example as string in {\PDOException}).

string getFile()

Since: 7.0

Gets the file in which the exception occurred

Return Value

string

Returns the name of the file from which the object was thrown.

int getLine()

Since: 7.0

Gets the line on which the object was instantiated

Return Value

int

Returns the line number where the thrown object was instantiated.

array getTrace()

Since: 7.0

Gets the stack trace

Return Value

array

Returns the stack trace as an array in the same format as {\debug_backtrace()}.

string getTraceAsString()

Since: 7.0

Gets the stack trace as a string

Return Value

string

Returns the stack trace as a string.

null|Throwable getPrevious()

Since: 7.0

Returns the previous Throwable

Return Value

null|Throwable

Returns the previous {\Throwable} if available, or NULL otherwise.