Can I use an exception as an easy way of jumping out of current context to some higher architecture layer to avoid routine return code checks (kinda if ($response['code'] != CodeStatus::SUCCESS) return null;)? The exceptions I talk about generally might mean something like invalid user account or smth, i.e it is not an emergency situation.
            Asked
            
        
        
            Active
            
        
            Viewed 34 times
        
    0
            
            
         
    
    
        Vadim Samokhin
        
- 3,378
- 4
- 40
- 68
- 
                    You may use knife to cut bread or to kill, just like with exceptions you can signal error or jump to arbitrary place upper in the call stack. I think you see analogy. – pkmiec Oct 16 '12 at 18:32
- 
                    So the question is -- is it the exception's purpose? And can I actually use them in cases that are not emergencies? Isn't it akin a goto operator? – Vadim Samokhin Oct 16 '12 at 18:38
1 Answers
0
            I guess the best answer I found is here.
Also some google research.
 
    
    
        Community
        
- 1
- 1
 
    
    
        Vadim Samokhin
        
- 3,378
- 4
- 40
- 68