A
Alex
Hi
I just want to clear something up in my head with while loops and
exceptions. I'm sure this will probably be a no brainer for most.
Check this simple pseudo-code out (vb.net):
------------------------------
try
While DRemail.Read
sendmail(DRemail("EMail")) 'Sends an email.
End While
Catch ex As Exception
logexception 'Logs the exception in a log somewhere
end try
------------------------------
Let's say this code iterates through a load of valid email addresses
and send out messages one by one.
Then it comes across a badly formatted email address such as
"fred@@@@flintstone..com", thus an exception will be captured and
logged.
Q - What happens after that exception is logged?
a) Does the while/end while loop abort completely? (not what I want)
b) Will it continue to try to send to the same dodgy email address in
an endless loop? (not good)
c) Will the while/end while loop be allowed to continue (jump over the
dodgy email address) and send out the rest of the emails one by one
(desirable, if this is not the case what do I need to do?).
Many Thanks...!
Alex
I just want to clear something up in my head with while loops and
exceptions. I'm sure this will probably be a no brainer for most.
Check this simple pseudo-code out (vb.net):
------------------------------
try
While DRemail.Read
sendmail(DRemail("EMail")) 'Sends an email.
End While
Catch ex As Exception
logexception 'Logs the exception in a log somewhere
end try
------------------------------
Let's say this code iterates through a load of valid email addresses
and send out messages one by one.
Then it comes across a badly formatted email address such as
"fred@@@@flintstone..com", thus an exception will be captured and
logged.
Q - What happens after that exception is logged?
a) Does the while/end while loop abort completely? (not what I want)
b) Will it continue to try to send to the same dodgy email address in
an endless loop? (not good)
c) Will the while/end while loop be allowed to continue (jump over the
dodgy email address) and send out the rest of the emails one by one
(desirable, if this is not the case what do I need to do?).
Many Thanks...!
Alex