CodeIgniter Forums

Full Version: Error/Exception handling
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]sqwk[/eluser]
How would I best use exceptions in Codeigniter? Do I just throw a new Exception and then catch it somewhere? Does that stop the execution of the code in the current file only or do exceptions bubble up and stop everything? Do they get logged by CI? When they are thrown or when they are caught? Does CI show an error message automatically or do I need to use show_error()?

I have a series of nested models with methods wrapped in transactions. If a transaction in a submodel fails I would assume that the parent transaction also fails? So really I don't need exceptions?

How would I best communicate something like 'No rows returned' to a parent model' as I would still like to return $this to preserve the already set attributes?

Can someone clarify some of these concepts?

El Forum

[eluser]InsiteFX[/eluser]
CodeIgniter uses its own Exception handling Class,
You would need to Extend it.

InsiteFX