Exceptions are used by functions and methods to communicate errors and unexpected behavior.
The Exception
object does not have public properties but contains private and protected properties that can be accessed via the constructor and methods.
The Exception
object provides the following methods:
Method |
Description |
Exception() |
The constructor of the |
getCode() |
Returns the exception code |
getFile() |
Returns the full path of the file where the exception was thrown. |
getMessage() |
Returns a string explaining why the exception was thrown. |
getLine() |
Returns the line number where the exception was thrown. |
getPrevious() |
If this exception was caused by another exception, this method returns the previous exception; otherwise, it returns |
getTrace() |
Returns an array containing information about all the functions that were executing when the exception was thrown. |
getTraceAsString() |
Returns the same information as |