[Gambas-user] Probably a really dumb question about Error

Jussi Lahtinen jussi.lahtinen at ...626...
Wed May 18 14:14:27 CEST 2016


Depends on your needs. You can use Try without Error, if you don't need to
handle the error situation, but that's bit weird and probably not the right
way to do what ever you try to do. Otherwise I use it like this:

Try something

If Error Then
  do something
  Error.Clear
Endif

So, you need to clear the error, only when there is something to be
cleared. Or if you don't handle the errors, then just clear after all the
Try commands.


Jussi


On Wed, May 18, 2016 at 1:47 PM, richard terry <rterry at ...1823...>
wrote:

> Hi List,
>
> I ran in to an odd problem when I used:
>
> Try whatever
> If error then
>     do-somehing
> end if
>
> Where despite Try Whatever, not generating an error, it still when on to
> the do-something. When I logged what was happening, it was carrying
> forward the last known error in my program (in this case where I'd
> tested for the existance of a particular directory).
>
> I read the docs, and it doesn't mention that one should do an
> error.clear, before a try
>
> But... If I put error.clear, before the above code, it doesn't trip the
> error, so logically it would seem to me that before every Try, one
> should do an error.clear
>
> ?is this correct.
>
> If not, could some kind sould explain to me what to do and how to user
> Error?
>
> Thanks
>
> richard
>
>
>
> ------------------------------------------------------------------------------
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data
> untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list