A break in the class module or a gap due to unprocessed errors (error checking error VB6, setting parameters in the IDE)

Basically, I'm trying to understand the difference between the “Class Break Module” and the “Raw Error Break” that appear in Visual Basic 6.0 in the following way:

Tools --> Options --> General --> Error Trapping 

Three options are possible:

  • Break in all the mistakes
  • Class break module
  • Break on unprocessed errors

Now, apparently, according to MSDN, the second option (Break in Class Module) actually just means "Break on Unhandled Errors in Class Modules". In addition, this option is apparently set by default (that is: I think it is installed on it out of the box).

I'm trying to find out if I have a second option, can I get a third option (Break on Unhandled Errors) for free? In this case, is it turned on by default for all scripts outside the spectrum of the class module? To advise, I do not have any class modules in my current active project. I have .bas modules. Also, is it possible that in the Mdules class they can also refer to normal .bas modules? (this is my second question).

Basically, I just want the settings to guarantee that there will be no surprises after exe is released. I want as many errors as possible to be displayed during development, and not to be displayed in release mode. Usually I have two types of On Error Resume Next in my forms, where there is no explicit error handling, they look like this:

On In the "Error retry" field "NOT REQUIRED

Things necessary are such as checking the correctness of the length of the array, if there is no call to its UBound errors, this means that it has no length, if it returns a value of 0 or more, then it has a length (and therefore exists). These types of error messages should remain active even during development. However, the NON-REQUIRED ones should not remain active during development, so I commented on all of them to make sure that I caught all existing errors.

Once I'm ready to free exe, I do CTRL + H to find all occurrences:

'For Continue error> NOT REQUIRED

(You may have noticed that they are commented) ... And replace them with:

In the field "Error while retrying next" is NOT REQUIRED

... Unapproved version, so in release mode, if there are any residual errors, they are not displayed to users.

For more information about the MSDN description in three parameters (which I read twice and still have not found), you can find the following link:

http://webcache.googleusercontent.com/search?q=cache:yUQZZK2n2IYJ:support.microsoft.com/kb/129876&hl=en&lr=lang_en%7Clang_tr&gl=au&tbs=lr:lang_1en%7Clang_1tr&prmdimv

I'm also interested in hearing your thoughts if you want to be called voluntarily (and that would be my preliminary / completely optional third question, which would be your thoughts on methods for handling return errors).

To summarize, the first two questions were: can we get option 3 included in all non-classical scenarios if we choose option 2? And is it possible that when they use the term "class module", they can also refer to .bas modules? (Since the .bad module is really just a class module that is pre-created in the background during startup).

Thanks.

+6
source share
2 answers

I will start with the first option. A break in all errors simply disables error handlers. This is useful when trying to debug after you have placed error handlers, because you may have errors in the handlers themselves or you may lose information about where the error occurred when the error bubbles up the container hierarchy (errors that don't happen handled in an attempt by the procedure to find the handler in the calling procedure, which can be confusing if you try to find an offensive line of code).

Further, the raw error break is not actually broken in the class module if there is a line of code that causes an error. If you have this option, and you call the method in the class, and there is an error in the line of code in the method, you break the line on your client with the method call.

The break in class module goes into a line of code in the class with an error. It should be noted that if you are working with ActiveX EXE, the control parameter is located in its project, and not in the client project. That is, you may have a gap of all errors installed in your client project, and a gap of unprocessed errors installed in your ActiveX EXE project, and you will not break the class module because you are working with two separate processes.

I prefer it to leave it set to break in the class module, because it allows you to more accurately navigate to the error site. This is before I started executing error handlers; at this moment I generally jump around all three, depending on what I'm trying to stabilize.

Finally, I DO NOT recommend EVER using On Error Resume Next, except in the context of built-in error handling.

+5
source

Yes, when you select "Break in class module", it still breaks on unprocessed errors, but it also interrupts ANY errors in class modules (not simple modules) that are not handled by the class module itself.

Contrast this to “break raw errors”, which will cause it to exit the class / user control code when an error occurs inside it, making it difficult to track the exact location.

It is probably best to leave it at the “break of raw errors” for general development, as others will get annoyed when you process errors that are benign. Note that it is best to try to detect them before they cause an error.

+3
source

Source: https://habr.com/ru/post/926733/


All Articles