Home All Groups Group Topic Archive Search About

Err object in class works and then not works.

Author
4 Jun 2005 7:54 PM
Temp795
Hi everyone,


Using vb6 with sp5.

Here is the background:

Have a class that I use to call a public function and I call this function
multiple types because I am in a for loop.  Inside the function I have the
error condition set to on error goto errors.  In the errors section I have it
log the error and then set the error catching off using on error goto 0 where
it then exits the function.  Upon the next loop of the for, we re-enter the
function again and the error condition is reset back to the above
for-mentioned statement. 


Here is the problem, at random times the function will not go to the error
section when an error occurs.  I get an error prompt with the message when
working in the ide and the program crashes when complied.  I even put a
counter in the error section and did a debug.print lngErrorCount and
sometimes the program will work for a while.  One run I got 49, another 340,
and 0(it error on the first time in the function).


Anyone have a clue why it is not working for the error catching?


Thanks Jon

Author
5 Jun 2005 1:48 AM
Larry Serflaten
Show quote Hide quote
"Temp795" <Temp***@discussions.microsoft.com> wrote
>
> Using vb6 with sp5.
>
> Here is the background:
>
> Have a class that I use to call a public function and I call this function
> multiple types because I am in a for loop.  Inside the function I have the
> error condition set to on error goto errors.  In the errors section I have it
> log the error and then set the error catching off using on error goto 0 where
> it then exits the function.  Upon the next loop of the for, we re-enter the
> function again and the error condition is reset back to the above
> for-mentioned statement. 
>
>
> Here is the problem, at random times the function will not go to the error
> section when an error occurs.  I get an error prompt with the message when
> working in the ide and the program crashes when complied.  I even put a
> counter in the error section and did a debug.print lngErrorCount and
> sometimes the program will work for a while.  One run I got 49, another 340,
> and 0(it error on the first time in the function).
>
>
> Anyone have a clue why it is not working for the error catching?


I'd suspect you have a second error happening, possibly in the error
handling code itself.  Can you reproduce that behavior in a small program
you can post to the group?  It helps to see the code being used, and
its even more of a help if we can see it on our own systems....

LFS
Author
5 Jun 2005 2:39 AM
Temp795
Larry,

THanks for responding, the code is a part of a program I have for working
with active directory and the error handling is standard.  Once I enter the
function I turn on error handling and from there any errors that come up
should head to the error handling section I have.  The only thing I can think
of is that the error happens so many times that the system just can't handle
it any more and for some reason does not go to the error section.  However as
I put in the first message it happened on the first time it entered the
function and so it is random. 

I have used the same format for error handling using the active directory
interface everwhere else but this one function is just buggin out for some
reason.


Show quoteHide quote
"Larry Serflaten" wrote:

>
> "Temp795" <Temp***@discussions.microsoft.com> wrote
> >
> > Using vb6 with sp5.
> >
> > Here is the background:
> >
> > Have a class that I use to call a public function and I call this function
> > multiple types because I am in a for loop.  Inside the function I have the
> > error condition set to on error goto errors.  In the errors section I have it
> > log the error and then set the error catching off using on error goto 0 where
> > it then exits the function.  Upon the next loop of the for, we re-enter the
> > function again and the error condition is reset back to the above
> > for-mentioned statement. 
> >
> >
> > Here is the problem, at random times the function will not go to the error
> > section when an error occurs.  I get an error prompt with the message when
> > working in the ide and the program crashes when complied.  I even put a
> > counter in the error section and did a debug.print lngErrorCount and
> > sometimes the program will work for a while.  One run I got 49, another 340,
> > and 0(it error on the first time in the function).
> >
> >
> > Anyone have a clue why it is not working for the error catching?
>
>
> I'd suspect you have a second error happening, possibly in the error
> handling code itself.  Can you reproduce that behavior in a small program
> you can post to the group?  It helps to see the code being used, and
> its even more of a help if we can see it on our own systems....
>
> LFS 
>
Author
5 Jun 2005 3:10 AM
Larry Serflaten
Show quote Hide quote
"Temp795" <Temp***@discussions.microsoft.com> wrote

> THanks for responding, the code is a part of a program I have for working
> with active directory and the error handling is standard.  Once I enter the
> function I turn on error handling and from there any errors that come up
> should head to the error handling section I have.  The only thing I can think
> of is that the error happens so many times that the system just can't handle
> it any more and for some reason does not go to the error section.  However as
> I put in the first message it happened on the first time it entered the
> function and so it is random. 

> I have used the same format for error handling using the active directory
> interface everwhere else but this one function is just buggin out for some
> reason.


OK, what is the error message, and, can you do a bit of logging to isolate the
line of code that causes it?

LFS
Author
5 Jun 2005 3:27 PM
Temp795
I know where the error occurs it is when I am setting the password in an xp
enviroment with the password requirements set to high. My code generates
passwords and of course they do not meet the requiments sometimes and it
throws an error when I try to assign the password.  Works fine when the
password requirements are set to low and works fine in a pure win2k
enviroment.  For some reason it likes to pick and choose when not to respond
to the error enviroment.

Show quoteHide quote
"Larry Serflaten" wrote:

>
> "Temp795" <Temp***@discussions.microsoft.com> wrote
>
> > THanks for responding, the code is a part of a program I have for working
> > with active directory and the error handling is standard.  Once I enter the
> > function I turn on error handling and from there any errors that come up
> > should head to the error handling section I have.  The only thing I can think
> > of is that the error happens so many times that the system just can't handle
> > it any more and for some reason does not go to the error section.  However as
> > I put in the first message it happened on the first time it entered the
> > function and so it is random. 
>
> > I have used the same format for error handling using the active directory
> > interface everwhere else but this one function is just buggin out for some
> > reason.
>
>
> OK, what is the error message, and, can you do a bit of logging to isolate the
> line of code that causes it?
>
> LFS
>
Author
5 Jun 2005 4:19 PM
David Youngblood
"Temp795" <Temp***@discussions.microsoft.com> wrote...
> I know where the error occurs it is when I am setting the password in an xp
> enviroment with the password requirements set to high. My code generates
> passwords and of course they do not meet the requiments sometimes and it
> throws an error when I try to assign the password.  Works fine when the
> password requirements are set to low and works fine in a pure win2k
> enviroment.  For some reason it likes to pick and choose when not to respond
> to the error enviroment.

On Error Goto 0 may not do what you think. It turns off error handling but does
not reset the error handler. This souldn't be a problem if you actually exit the
sub, as exiting the sub will resest the error handler. To see if it is the
problem, you might try On Error Goto -1 (undocumented) which does reset the
error handler.

After stepping through this sample, change On Error Goto 0 to On Error Goto -1
to see the difference.

ER:
    On Error GoTo EH
    Err.Raise 1
    Exit Sub
EH:
    On Error GoTo 0
    GoTo ER

David



Show quoteHide quote
> "Larry Serflaten" wrote:
>
> >
> > "Temp795" <Temp***@discussions.microsoft.com> wrote
> >
> > > THanks for responding, the code is a part of a program I have for working
> > > with active directory and the error handling is standard.  Once I enter
the
> > > function I turn on error handling and from there any errors that come up
> > > should head to the error handling section I have.  The only thing I can
think
> > > of is that the error happens so many times that the system just can't
handle
> > > it any more and for some reason does not go to the error section.  However
as
> > > I put in the first message it happened on the first time it entered the
> > > function and so it is random.
> >
> > > I have used the same format for error handling using the active directory
> > > interface everwhere else but this one function is just buggin out for some
> > > reason.
> >
> >
> > OK, what is the error message, and, can you do a bit of logging to isolate
the
> > line of code that causes it?
> >
> > LFS
> >
Author
5 Jun 2005 6:55 PM
Larry Serflaten
"Temp795" <Temp***@discussions.microsoft.com> wrote
> I know where the error occurs it is when I am setting the password in an xp
> enviroment with the password requirements set to high. My code generates
> passwords and of course they do not meet the requiments sometimes and it
> throws an error when I try to assign the password.  Works fine when the
> password requirements are set to low and works fine in a pure win2k
> enviroment.  For some reason it likes to pick and choose when not to respond
> to the error enviroment.

So are you saying that you know your random PW generator is building PWs
that fail some sort of test, which causes the error you are seeing?

If one solution is to generate more secure passwords, wouldn't that be a good
way to avoid the error?  Simply learn the requirements for the high setting and
build your passwords accordingly.

LFS
Author
5 Jun 2005 7:01 PM
Michael D. Ober
Show quote Hide quote
"Larry Serflaten" <serfla***@usinternet.com> wrote in message
news:OISSM%23faFHA.1448@TK2MSFTNGP09.phx.gbl...
>
> "Temp795" <Temp***@discussions.microsoft.com> wrote
> > I know where the error occurs it is when I am setting the password in an
xp
> > enviroment with the password requirements set to high. My code generates
> > passwords and of course they do not meet the requiments sometimes and it
> > throws an error when I try to assign the password.  Works fine when the
> > password requirements are set to low and works fine in a pure win2k
> > enviroment.  For some reason it likes to pick and choose when not to
respond
> > to the error enviroment.
>
> So are you saying that you know your random PW generator is building PWs
> that fail some sort of test, which causes the error you are seeing?
>
> If one solution is to generate more secure passwords, wouldn't that be a
good
> way to avoid the error?  Simply learn the requirements for the high
setting and
> build your passwords accordingly.
>

Normally I would agree that using the error handling system to catch out of
domain range entries is a poor decision, but in the case of passwords, the
sysadmin could change the password requirements at any time, thus you must
handle the errors.  Hopefully the errors also will tell you why the
passwords are being rejected so you can feed that information back into your
password generator (under code control) to reduce the number of invalid
passwords that are generated.

So OP is back to the issue of how to catch _ALL_ the errors that the
password changing interface throws back.

Mike Ober.

Show quoteHide quote
> LFS
>
>
Author
6 Jun 2005 12:12 AM
Temp795
HI everyone,

Thanks for giving me suggestions and ideas to work with.  I agree that my
password generator should be rebuilt with the high security in mind and while
I will undertake that mission I am still left with why the error system does
not allow my error handling routine to catch the error and deal with it.  If
the system would allow me to see that it errors on this password then I can
reset it to another one and try again.  However I can not do anything if the
system does not actually let me deal with it. 

I did try what David had suggest of setting the error condition to -1 and
this did not help from stopping the system from displaying an error message
instead of going into the error system.

Thanks


Show quoteHide quote
"Michael D. Ober" wrote:


>
> "Larry Serflaten" <serfla***@usinternet.com> wrote in message
> news:OISSM%23faFHA.1448@TK2MSFTNGP09.phx.gbl...
> >
> > "Temp795" <Temp***@discussions.microsoft.com> wrote
> > > I know where the error occurs it is when I am setting the password in an
> xp
> > > enviroment with the password requirements set to high. My code generates
> > > passwords and of course they do not meet the requiments sometimes and it
> > > throws an error when I try to assign the password.  Works fine when the
> > > password requirements are set to low and works fine in a pure win2k
> > > enviroment.  For some reason it likes to pick and choose when not to
> respond
> > > to the error enviroment.
> >
> > So are you saying that you know your random PW generator is building PWs
> > that fail some sort of test, which causes the error you are seeing?
> >
> > If one solution is to generate more secure passwords, wouldn't that be a
> good
> > way to avoid the error?  Simply learn the requirements for the high
> setting and
> > build your passwords accordingly.
> >
>
> Normally I would agree that using the error handling system to catch out of
> domain range entries is a poor decision, but in the case of passwords, the
> sysadmin could change the password requirements at any time, thus you must
> handle the errors.  Hopefully the errors also will tell you why the
> passwords are being rejected so you can feed that information back into your
> password generator (under code control) to reduce the number of invalid
> passwords that are generated.
>
> So OP is back to the issue of how to catch _ALL_ the errors that the
> password changing interface throws back.
>
> Mike Ober.
>
> > LFS
> >
> >
>
>
>
>
Author
6 Jun 2005 1:19 AM
Larry Serflaten
"Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote

> So OP is back to the issue of how to catch _ALL_ the errors that the
> password changing interface throws back.

Or finding a way to discover the current rules so that new PWs will pass....

LFS