Problems Using Error Event and On Error routines

Problems Using Error Event and On Error routines

Post by Bruce Parlie » Fri, 17 Dec 1999 04:00:00



Hello All,

I am developing an application which makes use of objects with special case
error handling code.  These objects can be used in order to repair a problem
that is data related, etc... There is a global error handler, common to the
whole application implemented with an "on error" clause.  My problem comes
when an Error Event in one object (we'll call it Object A) uses a method in
another object (Object B) with code in it's Error Event.  A line of code
causes an error in a method in Object A whose Error Event calls a method in
Object B.  A line of code in the method of Object B causes an error, which
pop's the Suspend/Retry or Ignore dialog.  If I suspend and step to the next
line of code in the de* I step into the first line of Object B's Error
Event, just as I would suspect, but why did the VFP error box appear ?  How
can I suppress it ?  If the error is ignored via the VFP dialog the error
event does not fire.

Thanks in advance for any help,
Bruce Parlier.

 
 
 

Problems Using Error Event and On Error routines

Post by Alexandre Pechtchansk » Fri, 17 Dec 1999 04:00:00




[ Courtesy cc'ed through e-mail to the quoted author ]

Quote:>Hello All,

>I am developing an application which makes use of objects with special case
>error handling code.  These objects can be used in order to repair a problem
>that is data related, etc... There is a global error handler, common to the
>whole application implemented with an "on error" clause.  My problem comes
>when an Error Event in one object (we'll call it Object A) uses a method in
>another object (Object B) with code in it's Error Event.  A line of code
>causes an error in a method in Object A whose Error Event calls a method in
>Object B.  A line of code in the method of Object B causes an error, which
>pop's the Suspend/Retry or Ignore dialog.  If I suspend and step to the next
>line of code in the de* I step into the first line of Object B's Error
>Event, just as I would suspect, but why did the VFP error box appear ?  How
>can I suppress it ?  If the error is ignored via the VFP dialog the error
>event does not fire.

I believe that user-specified event handler can be exactly 1 level deep, and any
errors in it automagically invoke default FoxPro error handler.  This was
discussed at some length in this group, and may be even documented in FoxPro
docs somewhere.

[ When replying, remove *'s from address ]
Alexandre Pechtchanski, Systems Manager, RUH, NY

 
 
 

Problems Using Error Event and On Error routines

Post by Bruce Parlie » Fri, 17 Dec 1999 04:00:00


This behavior is documented in VFP help but only in relation to the "ON
ERROR" clause.  I was hoping the the use of the error events of the objects
involved in place of on error clauses would get around this limitation.

I will check out Deja-News for old threads on this subject, thanks for the
suggestion.




> [ Courtesy cc'ed through e-mail to the quoted author ]

> >Hello All,

> >I am developing an application which makes use of objects with special
case
> >error handling code.  These objects can be used in order to repair a
problem
> >that is data related, etc... There is a global error handler, common to
the
> >whole application implemented with an "on error" clause.  My problem
comes
> >when an Error Event in one object (we'll call it Object A) uses a method
in
> >another object (Object B) with code in it's Error Event.  A line of code
> >causes an error in a method in Object A whose Error Event calls a method
in
> >Object B.  A line of code in the method of Object B causes an error,
which
> >pop's the Suspend/Retry or Ignore dialog.  If I suspend and step to the
next
> >line of code in the de* I step into the first line of Object B's
Error
> >Event, just as I would suspect, but why did the VFP error box appear ?
How
> >can I suppress it ?  If the error is ignored via the VFP dialog the error
> >event does not fire.

> I believe that user-specified event handler can be exactly 1 level deep,
and any
> errors in it automagically invoke default FoxPro error handler.  This was
> discussed at some length in this group, and may be even documented in
FoxPro
> docs somewhere.

> [ When replying, remove *'s from address ]
> Alexandre Pechtchanski, Systems Manager, RUH, NY

 
 
 

Problems Using Error Event and On Error routines

Post by Craig Berntso » Sat, 18 Dec 1999 04:00:00


That's not true. The Fox error handler does not always display. I use custom
error handlers in the Error method and display my own error message. For a
complete discussion of error handling in VFP, read the whitepaper at
www.stonefield.com.

--

Craig Berntson
MCP, Microsoft FoxPro MVP
Salt Lake City Fox User Group
http://www.veryComputer.com/




> [ Courtesy cc'ed through e-mail to the quoted author ]

> >Hello All,

> >I am developing an application which makes use of objects with special
case
> >error handling code.  These objects can be used in order to repair a
problem
> >that is data related, etc... There is a global error handler, common to
the
> >whole application implemented with an "on error" clause.  My problem
comes
> >when an Error Event in one object (we'll call it Object A) uses a method
in
> >another object (Object B) with code in it's Error Event.  A line of code
> >causes an error in a method in Object A whose Error Event calls a method
in
> >Object B.  A line of code in the method of Object B causes an error,
which
> >pop's the Suspend/Retry or Ignore dialog.  If I suspend and step to the
next
> >line of code in the de* I step into the first line of Object B's
Error
> >Event, just as I would suspect, but why did the VFP error box appear ?
How
> >can I suppress it ?  If the error is ignored via the VFP dialog the error
> >event does not fire.

> I believe that user-specified event handler can be exactly 1 level deep,
and any
> errors in it automagically invoke default FoxPro error handler.  This was
> discussed at some length in this group, and may be even documented in
FoxPro
> docs somewhere.

> [ When replying, remove *'s from address ]
> Alexandre Pechtchanski, Systems Manager, RUH, NY

 
 
 

Problems Using Error Event and On Error routines

Post by Bruce Parlie » Tue, 21 Dec 1999 04:00:00


I don't believe you completely understand my problem, I was attempting to
use an error handler within an error handler - ie you execute code that
causes an error, and the code executed by that error handler makes use of
it's own error handler.  The white paper you speak of, an excellent paper by
the way, contains this text:

One thing to keep in mind is that the complete error handling chain must be
the most bug-free part of your application, since the only fallback if an
error occurs in any code called while in the error state is the VFP
Cancel/Ignore dialog.

I do appreciate your input however,
Bruce.


> That's not true. The Fox error handler does not always display. I use
custom
> error handlers in the Error method and display my own error message. For a
> complete discussion of error handling in VFP, read the whitepaper at
> www.stonefield.com.

> --

> Craig Berntson
> MCP, Microsoft FoxPro MVP
> Salt Lake City Fox User Group
> http://www.veryComputer.com/



> > On Thu, 16 Dec 1999 12:16:19 -0500, "Bruce Parlier"


- Show quoted text -


> > [ Courtesy cc'ed through e-mail to the quoted author ]

> > >Hello All,

> > >I am developing an application which makes use of objects with special
> case
> > >error handling code.  These objects can be used in order to repair a
> problem
> > >that is data related, etc... There is a global error handler, common to
> the
> > >whole application implemented with an "on error" clause.  My problem
> comes
> > >when an Error Event in one object (we'll call it Object A) uses a
method
> in
> > >another object (Object B) with code in it's Error Event.  A line of
code
> > >causes an error in a method in Object A whose Error Event calls a
method
> in
> > >Object B.  A line of code in the method of Object B causes an error,
> which
> > >pop's the Suspend/Retry or Ignore dialog.  If I suspend and step to the
> next
> > >line of code in the de* I step into the first line of Object B's
> Error
> > >Event, just as I would suspect, but why did the VFP error box appear ?
> How
> > >can I suppress it ?  If the error is ignored via the VFP dialog the
error
> > >event does not fire.

> > I believe that user-specified event handler can be exactly 1 level deep,
> and any
> > errors in it automagically invoke default FoxPro error handler.  This
was
> > discussed at some length in this group, and may be even documented in
> FoxPro
> > docs somewhere.

> > [ When replying, remove *'s from address ]
> > Alexandre Pechtchanski, Systems Manager, RUH, NY