Something like the old VB6 Resume Next?

Hello all,

In VB6 error handling, if I added the code Resume Next in an error handler, the app would jump to the line of code directly following the offending line - thereby offering a very fast way to find the offending code.

Is there such a beast in Xojo?

Thanks,
Tim

Not really no
You’d have to put try catch around every line single to simulate that

What is it you’re trying to do that you want Resume Next ?

Didn’t think so… bummer.
Would make it much much easier to find, especially when the error does not occur on a regular basis.

Thanks for the confirmation Norman.
Tim

use a variable as help
something as iwashere=“step 1” iwashere=“step 2” iwashere=“step 3”
and at catch you use system.debug(iwashere)

at vb6 i used conditional compilation so this “on error goto …” was bypassed at my wish and the debugger hold at this problematic row.
i think you can do something similar at xojo too.

I am using a location variable, just takes a LONG time to find the culprit!

#if DebugBuild then 
  area = 8
  print "area = " + Cstr(area)
#Endif

Tim

For such things, I like System.debuglog. Beats Print as far as I am concerned. You get the log entries real time in the message pane of the IDE.

The “on error resume next” thing was one of the many things I never understood in VB… Why would one ignore an error and execute the following, related, lines anyway?
If you get an exception, you handle it outside of the block (or you exit the current method), but you don’t just “ignore the problem and continue dealing with lines that then become problematic”, seems nonsense to me…

[quote=492562:@Arnaud Nicolet]The “on error resume next” thing was one of the many things I never understood in VB… Why would one ignore an error and execute the following, related, lines anyway?
If you get an exception, you handle it outside of the block (or you exit the current method), but you don’t just “ignore the problem and continue dealing with lines that then become problematic”, seems nonsense to me…[/quote]

all this stupid ms methods raise a error for everything. its more a on error shut up :slight_smile:
if not your app will break at run time without a good reason.
most of the ms methods i wrapped in own methods which just return a true / false for execution.

as example if you add a key value to a collection and the key already exist you get a error but as developer it was the intention
not having double keys in this list and the origin list had it.

general resume next is risky if people not know what they do.

nobody will use error handling for each single command. methods respectively the app should be stable as possible.

ms methods not differentiate good between errors and warnings.

[quote=492568:@Markus Rauch]all this stupid ms methods raise a error for everything. its more a on error shut up :slight_smile:
if not your app will break at run time without a good reason.
most of the ms methods i wrapped in own methods which just return a true / false for execution.

as example if you add a key value to a collection and the key already exist you get a error but as developer it was the intention
not having double keys in this list and the origin list had it.

general resume next is risky if people not know what they do.

nobody will use error handling for each single command. methods respectively the app should be stable as possible.

ms methods not differentiate good between errors and warnings.[/quote]
Agreed.

“on error resume next” is for wannabees who didn’t know anything about programming. VBA still doesn’t have any error handling so making nice errors was really hard.

It made it MUCH easier to FIND the offending line. Especially in cases where the error would occur inconsistently.

I never used it for product, as someone else wrote what good is error handling/management when the error is ignored?!