Thursday, August 11, 2005

Fixed an annoying little problem with my email parser

I was having trouble with error handling on my email parsing macro. Whenever the script tried to return a bad URL or one that could not be returned as text, I was using "On Error Goto..." and directing to an error handling branch that ran (marking the URL as "BAD" by coloring it RED and then directed back to the next URL.

This would run just fine once (it could handle one bad URL), but when it encountered another bad URL, it would puke.

I have since changed to using "On Error Resume Next" and following the two lines of code prone to erroring out, I placed this bit of code:


If Err Then
GoTo BAD_URL ' Error Handling Branch
End If



Then, at the end of the error handling branch, just before directing back to the next URL, I cleared the Err object.


Err.Clear



Now it can handle errors an unlimited number of times. I'm so happy.

Later.

No comments: