Re: Error Handling Etiquette
From: Marina (someone_at_nospam.com)
Date: 09/08/04
- Next message: Tom Dacon: "Re: Custom Tab Control Colors"
- Previous message: Terry Olsen: "Re: RS232 Anyone???"
- In reply to: mark: "Error Handling Etiquette"
- Next in thread: Tom Shelton: "Re: Error Handling Etiquette"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 8 Sep 2004 12:49:32 -0400
Move the 'final statements' to inside the try block. That way the stuff at
106, is right after the try/catch/finally, and should always be executed
anyway.
"mark" <mark@discussions.microsoft.com> wrote in message
news:82997FA6-E71B-478D-A764-FB077924ED14@microsoft.com...
> Consider the following error handling scheme:
>
> Statements
> Try
> more stastements
> Catch ex As Exception
> MsgBox(ex.Message)
> GoTo 106
> End Try
> final statements
> 106: 'some meaningless comment
> End Sub
>
> I want to abort the sub and not execute the final statements if an error
> occurs.
> I use the GoTo 106 to branch to the last line which is a comment.
>
> It works, but it seems sloppy to me. How would a good programmer abort the
> sub in an error condition?
> --
> mark
- Next message: Tom Dacon: "Re: Custom Tab Control Colors"
- Previous message: Terry Olsen: "Re: RS232 Anyone???"
- In reply to: mark: "Error Handling Etiquette"
- Next in thread: Tom Shelton: "Re: Error Handling Etiquette"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|