Best way to handle exception

brelto85

Active Member
Licensed User
Longtime User
Hi,

What' s the best way to handle exceptions?

In leaving aside from the fact that the application should be stable, in the case should be in error, how to behave in a scenario of a distributed application?

From what i understand, the Log() method is used only for debugging

1. Must make sure that the log is sent to the console of google?
2. Need to handle crashes and the NRA?
3. You have to save the errors to a log file, so as to allow then to send it to some address?

thanks
alberto
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
A crash report will only be sent if the program crashes. If you catch the exception then it will not crash. Try / Catch should be used when there might be a problem which you cannot control. For example you parse a downloaded feed. The feed itself might have problems.

Try / Catch should not be used to protect from programming mistakes.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I happened to receive error messages from an acitivity, which ask if you want to continue or close the app.

Hence, they are not errors catched by try / catch and not errors that crash the program.

Is there a way to intercept these?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Please start a new thread for this question and also post the error message from the logs.

They are old errors. If they happen again I will post them (if I remember correctly, some were sql query. ... I'm thinking, because, even though I had planned to handle all the queries into a single module, in fact some of them are build and executed in some activity).

However, it would be useful a way to delegate errors handling to a "centralized" module, in cases where they are not managed "locally"
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…