Trapping Error Messages 
Author Message
 Trapping Error Messages

I'm new to the scripting world so please bear with me.  We are trying to
"update" one of our bat processes so that it become more flexible and
secure.  So, we're looking at converting the batch process into a script
(i.e. VBS.).  Is there any way to trap an error message using either VBS. or
WSH?  For instance, a call is made to a database, and the user enters the
wrong password, I would like to trap this error somehow.  Is this possible
or do I have to be checked in to a psyche ward?  Thanks.

PGC



Sat, 23 Feb 2002 03:00:00 GMT  
 Trapping Error Messages

Quote:

> I'm new to the scripting world so please bear with me.  We are trying
> to "update" one of our bat processes so that it become more flexible
> and secure.  So, we're looking at converting the batch process into a
> script (i.e. VBS.).  Is there any way to trap an error message using
> either VBS. or WSH?  For instance, a call is made to a database, and
> the user enters the wrong password, I would like to trap this error
> somehow.  Is this possible or do I have to be checked in to a psyche
> ward?  Thanks.

> PGC

I believe the answer is almost certainly yes, but the actual method used
to do the trapping will depend on how the database process is invoked
and how it communicates with the OS.  For example, most (all?) Win 32
API processes (DLL and Ocx functions and methods) will raise an error
which can be tested in VBScript with an 'On Error Resume Next'/
'Password process' / 'if Err.Number > 0 Then ...' set of constructs.
However, if the process is a self contained Win 32 or console based
application, the solution may be to use the Windows Shell .Run method
and test the resulting 'return code'.  I think you need to be more
specific about the actual application to get a more definitive response.

Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/



Sat, 23 Feb 2002 03:00:00 GMT  
 Trapping Error Messages
Thanks for the reply.  What we are attempting to do is run a series of SQL
procedures on a Sybase 11.5 database using ISQL.  The DBA is to type in the
database password and then execute the procedure.  Currently, if the
password fails, it skips that procedure.  What we want to do is trap the
error message so that it won't skip that proc until the correct password is
entered or it fails out after three attempts.  I hope this doesn't sound
confusing, but our environment is very confusing.  Thanks for the tips.
I'll talk to my groupmates and see what we can come up with.  But if you
have any other ideas, please let me know.  Thanks again.

PGC


Quote:

> > I'm new to the scripting world so please bear with me.  We are trying
> > to "update" one of our bat processes so that it become more flexible
> > and secure.  So, we're looking at converting the batch process into a
> > script (i.e. VBS.).  Is there any way to trap an error message using
> > either VBS. or WSH?  For instance, a call is made to a database, and
> > the user enters the wrong password, I would like to trap this error
> > somehow.  Is this possible or do I have to be checked in to a psyche
> > ward?  Thanks.

> > PGC

> I believe the answer is almost certainly yes, but the actual method used
> to do the trapping will depend on how the database process is invoked
> and how it communicates with the OS.  For example, most (all?) Win 32
> API processes (DLL and Ocx functions and methods) will raise an error
> which can be tested in VBScript with an 'On Error Resume Next'/
> 'Password process' / 'if Err.Number > 0 Then ...' set of constructs.
> However, if the process is a self contained Win 32 or console based
> application, the solution may be to use the Windows Shell .Run method
> and test the resulting 'return code'.  I think you need to be more
> specific about the actual application to get a more definitive response.

> Tom Lavedas
> -----------
> http://www.pressroom.com/~tglbatch/



Sat, 23 Feb 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Custom 500 error page - trapping the error text?

2. trapping specific status messages

3. Trap undeliverable email message

4. Help with error trapping Jet 4.0/.mdb please

5. Need advice on error trapping Jet 4.0/.mdb operations

6. Need to trap a database error in server-side asp

7. Trap error?

8. cannot trap security error...

9. how to trap a security error?

10. Trapping Automation Server errors

11. How to trap an error object in Jscript

12. ODBC Connection Error Trapping

 

 
Powered by phpBB® Forum Software