caedo Posted July 8, 2008 Share Posted July 8, 2008 Good day, I'm having problems using exceptions in the following code: private function readFile($file){ //this wont work and will throw the exception. if($handle = fopen($file.'asdasdasdasdas', "rb")){ }else{ throw new Exception('Unable to load'); } } try{ $this->readFileForModules($file); }catch (Exception $ex){ echo $ex->getMessage(); } It throws the exception but still, it throws the error too: Warning: fopen(C:\templates\basic.tplasdasdasdasdas) [function.fopen]: failed to open stream Unable to load I want that only the exception message is shown, not the error. can you help me? thanks in advance caedo Quote Link to comment Share on other sites More sharing options...
DarkWater Posted July 8, 2008 Share Posted July 8, 2008 if($handle = @fopen($file.'asdasdasdasdas', "rb")){ Quote Link to comment Share on other sites More sharing options...
caedo Posted July 8, 2008 Author Share Posted July 8, 2008 thanks dark water, that solved the problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.