Support the ongoing development of Laravel.io →
Security Architecture
Last updated 3 weeks ago.
0

Laravel is namespaced, so you must use "\Exception":

try{
    // try code
} 
catch(\Exception $e){
    // catch code
}
Last updated 6 years ago.
1

youndivian said:

Laravel is namespaced, so you must use "\Exception":

try{
   // try code
} 
catch(\Exception $e){
   // catch code
}

Thanks buddy! this saved me a lot of time

0

youndivian said:

Laravel is namespaced, so you must use "\Exception":

try{
   // try code
} 
catch(\Exception $e){
   // catch code
}

Same here man, saved me a lot of time, thanks.

0

youndivian said:

Laravel is namespaced, so you must use "\Exception":

catch(\Exception $e){
   // catch code
}

tanks. its work. but for what?

(\Exception

and no

(Exception

:/

Last updated 5 years ago.
0

mortezaataiy said:

youndivian said:

Laravel is namespaced, so you must use "\Exception":

catch(\Exception $e){
   // catch code
}

tanks. its work. but for what?

(\Exception

and no

(Exception

:/

You have to import Exception class and there are two ways of using class on Laravel Controller,

1). Either on the top you can write Use Exception; 2). or you can directly use exception class by \Exception

Last updated 5 years ago.
0

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

abelkbil abelkbil abelkbil Joined 22 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.