mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-29 22:12:07 +03:00
Fix exception handling example
This commit is contained in:
parent
7cc32b69a3
commit
ca98611c09
@ -837,11 +837,14 @@ try {
|
|||||||
// Handle exception
|
// Handle exception
|
||||||
}
|
}
|
||||||
|
|
||||||
// When using try catch blocks in a namespaced environment use the following
|
// When using try catch blocks in a namespaced environment it is important to
|
||||||
|
// escape to the global namespace, because Exceptions are classes, and the
|
||||||
|
// Exception class exists in the global namespace. This can be done using a
|
||||||
|
// leading backslash to catch the Exception.
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Do something
|
// Do something
|
||||||
} catch (Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// Handle exception
|
// Handle exception
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user