A leave can be caught so you can handle the error or threatment that caused it. A panic cannot (at least, not easily).
So use leave for "normal" errors that can occur during the execution of your application.
Use Panic to handle error resulting from coding problems.
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Yep, panics should be used for indicating a situation that can be remedied only by fixing the code. Leaves are situations where something cannot be done but the application has the chance to handle this event somehow (roll back, try again, try something else).
Panics are meant to restart the program (reboot in some cases) so that the system can recover from the error that has caused it. Leaves are anticipated so that all cleanup tasks can be taken care of when a function Leaves. I can not understand the point of catching a panic as a panic is not expected to occur.
Forum posts: 1891
A leave can be caught so you can handle the error or threatment that caused it. A panic cannot (at least, not easily).
So use leave for "normal" errors that can occur during the execution of your application.
Use Panic to handle error resulting from coding problems.
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 56
hi eric. is there any way to trap a PANIC.. as we can do with leave.
Forum posts: 136
Sort of but it is not at all straightforward.
Why do you want to? A panic means something so bad has happened that the code should terminate running immediatly.
Forum posts: 588
Yep, panics should be used for indicating a situation that can be remedied only by fixing the code. Leaves are situations where something cannot be done but the application has the chance to handle this event somehow (roll back, try again, try something else).
Forum posts: 25
Panics are meant to restart the program (reboot in some cases) so that the system can recover from the error that has caused it. Leaves are anticipated so that all cleanup tasks can be taken care of when a function Leaves. I can not understand the point of catching a panic as a panic is not expected to occur.
Forum posts: 56
ohh.. got it.. Panics should not be handled...
..but i am very curious to know how do we trap a Panic?
Forum posts: 56
i think i will search for it rather than asking... sorry..!