User::Panic vs User::Leave

Login to reply to this topic.
Tue, 2008-03-18 09:45
Joined: 2008-01-22
Forum posts: 8

What is the difference betn panic and leave?


Tue, 2008-03-18 15:25
NewLC AdministratorSymbian AccreditedForum Nokia Champion
Joined: 2003-01-14
Forum posts: 1891
Re: User::Panic vs User::Leave

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

Tue, 2008-03-18 19:38
Joined: 2005-12-07
Forum posts: 56
Re: User::Panic vs User::Leave

hi eric. is there any way to trap a PANIC.. as we can do with leave.

Tue, 2008-03-18 23:46
Joined: 2007-09-23
Forum posts: 136
Re: User::Panic vs User::Leave

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.

Wed, 2008-03-19 10:27
Joined: 2003-12-05
Forum posts: 588
Re: User::Panic vs User::Leave

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).

Wed, 2008-03-19 11:02
Joined: 2007-09-03
Forum posts: 25
Re: User::Panic vs User::Leave

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.

Wed, 2008-03-19 11:54
Joined: 2005-12-07
Forum posts: 56
Re: User::Panic vs User::Leave

ohh.. got it.. Panics should not be handled... Smiling
..but i am very curious to know how do we trap a Panic?

Wed, 2008-03-19 11:57
Joined: 2005-12-07
Forum posts: 56
Re: User::Panic vs User::Leave

i think i will search for it rather than asking... sorry..!

  • Login to reply to this topic.