I'm trying to figure out if there is a way to generate standard error handlers
that "know" if the calling code has an error handler in effect (On Error Goto
<label> or On Error Resume Next) before deciding how to respond. Does anyone
know if this is possible. 16 2652
On Sun, 06 Jun 2004 02:44:11 GMT, Steve Jorgensen
<no****@nospam. nospam> wrote:
If you tell us why you need this, perhaps we can respond better.
Short answer: yes, but you'll need to keep track of the call stack
yourself.
-Tom. I'm trying to figure out if there is a way to generate standard error handlers that "know" if the calling code has an error handler in effect (On Error Goto <label> or On Error Resume Next) before deciding how to respond. Does anyone know if this is possible.
On Sat, 05 Jun 2004 20:50:17 -0700, Tom van Stiphout <to*****@no.spa m.cox.net>
wrote: On Sun, 06 Jun 2004 02:44:11 GMT, Steve Jorgensen <no****@nospam .nospam> wrote:
If you tell us why you need this, perhaps we can respond better.
Short answer: yes, but you'll need to keep track of the call stack yourself.
-Tom.
I'm trying to figure out if there is a way to generate standard error handlers that "know" if the calling code has an error handler in effect (On Error Goto <label> or On Error Resume Next) before deciding how to respond. Does anyone know if this is possible.
Basically, I'm trying to reduce the number of standard variations of error
handling code block I need to implement in an app that will run and handle
errors gracefully and appropriately in the Access run-time environment.
The conflict now, is between 2 standard cases:
1. Any code (except special cases) that will execute in response to a user
event must have an error handler that displays an error message (possibly
logging the error, etc.) and resumes at the procedure exit point.
2. Any code called by other code should, by default, re-raise the error to
calling code, adding its procedure name to the Source to show the call stack.
If you use 2 where you should use 1, the calling code may proceed on the
assumption that the called code did its job correctly, and this can be a
dangerous assumption when it didn't. Furthermore, there can be cases where a
procedure may be either case 1 or case 2 in different circumstances.
What I'm hoping to have is an error handling block that knows to display a
message and exit if no error handler is in effect in calling code, and to
re-raise the error if there is an error handler in effect in the calling code.
On Sun, 06 Jun 2004 04:56:18 GMT, Steve Jorgensen
<no****@nospam. nospam> wrote:
If you outfit every proc with a Push and a Pop function to push and
pop its name on and off the stack, and you would pass an extra
argument indicating if this proc is using an error handler or not,
then you could in an error handling block walk that stack and check
the presence or absence of an error handler.
Unfortunately, unlike the .NET environment, in Access you don't have
access to the stack, so the above is doing a similar thing the hard
way.
Personally, I don't make a distinction between case 1 and case 2, and
I "always" implement case 1.
-Tom. On Sat, 05 Jun 2004 20:50:17 -0700, Tom van Stiphout <to*****@no.spa m.cox.net> wrote:
On Sun, 06 Jun 2004 02:44:11 GMT, Steve Jorgensen <no****@nospa m.nospam> wrote:
If you tell us why you need this, perhaps we can respond better.
Short answer: yes, but you'll need to keep track of the call stack yourself.
-Tom.
I'm trying to figure out if there is a way to generate standard error handlers that "know" if the calling code has an error handler in effect (On Error Goto <label> or On Error Resume Next) before deciding how to respond. Does anyone know if this is possible.
Basically, I'm trying to reduce the number of standard variations of error handling code block I need to implement in an app that will run and handle errors gracefully and appropriately in the Access run-time environment.
The conflict now, is between 2 standard cases: 1. Any code (except special cases) that will execute in response to a user event must have an error handler that displays an error message (possibly logging the error, etc.) and resumes at the procedure exit point. 2. Any code called by other code should, by default, re-raise the error to calling code, adding its procedure name to the Source to show the call stack.
If you use 2 where you should use 1, the calling code may proceed on the assumption that the called code did its job correctly, and this can be a dangerous assumption when it didn't. Furthermore, there can be cases where a procedure may be either case 1 or case 2 in different circumstances.
What I'm hoping to have is an error handling block that knows to display a message and exit if no error handler is in effect in calling code, and to re-raise the error if there is an error handler in effect in the calling code.
On Sat, 05 Jun 2004 22:21:56 -0700, Tom van Stiphout <to*****@no.spa m.cox.net>
wrote: On Sun, 06 Jun 2004 04:56:18 GMT, Steve Jorgensen <no****@nospam .nospam> wrote:
If you outfit every proc with a Push and a Pop function to push and pop its name on and off the stack, and you would pass an extra argument indicating if this proc is using an error handler or not, then you could in an error handling block walk that stack and check the presence or absence of an error handler.
Unfortunatel y, unlike the .NET environment, in Access you don't have access to the stack, so the above is doing a similar thing the hard way.
Personally, I don't make a distinction between case 1 and case 2, and I "always" implement case 1.
-Tom.
On Sat, 05 Jun 2004 20:50:17 -0700, Tom van Stiphout <to*****@no.spa m.cox.net> wrote:
On Sun, 06 Jun 2004 02:44:11 GMT, Steve Jorgensen <no****@nosp am.nospam> wrote:
If you tell us why you need this, perhaps we can respond better.
Short answer: yes, but you'll need to keep track of the call stack yourself.
-Tom.
I'm trying to figure out if there is a way to generate standard error handlers that "know" if the calling code has an error handler in effect (On Error Goto <label> or On Error Resume Next) before deciding how to respond. Does anyone know if this is possible.
Basically, I'm trying to reduce the number of standard variations of error handling code block I need to implement in an app that will run and handle errors gracefully and appropriately in the Access run-time environment.
The conflict now, is between 2 standard cases: 1. Any code (except special cases) that will execute in response to a user event must have an error handler that displays an error message (possibly logging the error, etc.) and resumes at the procedure exit point. 2. Any code called by other code should, by default, re-raise the error to calling code, adding its procedure name to the Source to show the call stack.
If you use 2 where you should use 1, the calling code may proceed on the assumption that the called code did its job correctly, and this can be a dangerous assumption when it didn't. Furthermore, there can be cases where a procedure may be either case 1 or case 2 in different circumstances.
What I'm hoping to have is an error handling block that knows to display a message and exit if no error handler is in effect in calling code, and to re-raise the error if there is an error handler in effect in the calling code.
Of course, what I wrote above was slightly backward. If you use case 2 when
you should use case 1, you crash out of Access. If you use case 1 when you
use case 2, the calling code can proceed thinking the called code did its job.
About 3/4 of the time, that's OK. Other times, the calling code will error
again because something it expected didn't happen, and the user now has to
click OK 2 or more times for a single error. A few other times, the
procedures could both be handling part of a transactional process (either
formally with a database transaction, informally with some sort of deletion
roll-back), and data can be left in an invalid state according to the business
rules.
I thought of custom the stack idea, but I don't know if code can always be
guaranteed to be stacked in the order of execution. For instance, a timer
event could fire while a modal form is open (though I avoid timer events when
I can). There are probably other ways this could happen that I haven't
thought of.
On Sun, 06 Jun 2004 05:53:28 GMT, Steve Jorgensen
<no****@nospam. nospam> wrote:
I'm not concerned about your Timer example. When the timer ticks, your
proc is added to the stack, the code runs and finishes, Pop is called,
the stack frame cleans up, and you're back where you were.
In all the years I have used the Push/Pop code, with additional bounds
checking added, I have never seen it fail, other than due to
programmer error (Exit Function without Pop).
-Tom. On Sat, 05 Jun 2004 22:21:56 -0700, Tom van Stiphout <to*****@no.spa m.cox.net> wrote:
On Sun, 06 Jun 2004 04:56:18 GMT, Steve Jorgensen <no****@nospa m.nospam> wrote:
If you outfit every proc with a Push and a Pop function to push and pop its name on and off the stack, and you would pass an extra argument indicating if this proc is using an error handler or not, then you could in an error handling block walk that stack and check the presence or absence of an error handler.
Unfortunately , unlike the .NET environment, in Access you don't have access to the stack, so the above is doing a similar thing the hard way.
Personally, I don't make a distinction between case 1 and case 2, and I "always" implement case 1.
-Tom.
On Sat, 05 Jun 2004 20:50:17 -0700, Tom van Stiphout <to*****@no.spa m.cox.net> wrote:
On Sun, 06 Jun 2004 02:44:11 GMT, Steve Jorgensen <no****@nos pam.nospam> wrote:
If you tell us why you need this, perhaps we can respond better.
Short answer: yes, but you'll need to keep track of the call stack yourself.
-Tom.
>I'm trying to figure out if there is a way to generate standard error handlers >that "know" if the calling code has an error handler in effect (On Error Goto ><label> or On Error Resume Next) before deciding how to respond. Does anyone >know if this is possible.
Basically, I'm trying to reduce the number of standard variations of error handling code block I need to implement in an app that will run and handle errors gracefully and appropriately in the Access run-time environment.
The conflict now, is between 2 standard cases: 1. Any code (except special cases) that will execute in response to a user event must have an error handler that displays an error message (possibly logging the error, etc.) and resumes at the procedure exit point. 2. Any code called by other code should, by default, re-raise the error to calling code, adding its procedure name to the Source to show the call stack.
If you use 2 where you should use 1, the calling code may proceed on the assumption that the called code did its job correctly, and this can be a dangerous assumption when it didn't. Furthermore, there can be cases where a procedure may be either case 1 or case 2 in different circumstances.
What I'm hoping to have is an error handling block that knows to display a message and exit if no error handler is in effect in calling code, and to re-raise the error if there is an error handler in effect in the calling code.
Of course, what I wrote above was slightly backward. If you use case 2 when you should use case 1, you crash out of Access. If you use case 1 when you use case 2, the calling code can proceed thinking the called code did its job. About 3/4 of the time, that's OK. Other times, the calling code will error again because something it expected didn't happen, and the user now has to click OK 2 or more times for a single error. A few other times, the procedures could both be handling part of a transactional process (either formally with a database transaction, informally with some sort of deletion roll-back), and data can be left in an invalid state according to the business rules.
I thought of custom the stack idea, but I don't know if code can always be guaranteed to be stacked in the order of execution. For instance, a timer event could fire while a modal form is open (though I avoid timer events when I can). There are probably other ways this could happen that I haven't thought of.
On Sun, 06 Jun 2004 10:17:29 -0700, Tom van Stiphout <to*****@no.spa m.cox.net>
wrote: On Sun, 06 Jun 2004 05:53:28 GMT, Steve Jorgensen <no****@nospam .nospam> wrote:
I'm not concerned about your Timer example. When the timer ticks, your proc is added to the stack, the code runs and finishes, Pop is called, the stack frame cleans up, and you're back where you were.
But the whole point of the stack is that it's supposed to track whether the
calling code has an error handler. The timer event will be on the stack,
possibly after another procedure with an error handler, wit the timer event
was not called by that code. Thus, the error handler will think it should
re-raise the error, and crash out of Access when it does. I'm a little
concerned about this, but more concerned about other types of out-of-order
events I might not have considered.
In all the years I have used the Push/Pop code, with additional bounds checking added, I have never seen it fail, other than due to programmer error (Exit Function without Pop).
So perhaps, the timer is the only possible case? -Tom. On Sat, 05 Jun 2004 22:21:56 -0700, Tom van Stiphout <to*****@no.spa m.cox.net> wrote:
On Sun, 06 Jun 2004 04:56:18 GMT, Steve Jorgensen <no****@nosp am.nospam> wrote:
If you outfit every proc with a Push and a Pop function to push and pop its name on and off the stack, and you would pass an extra argument indicating if this proc is using an error handler or not, then you could in an error handling block walk that stack and check the presence or absence of an error handler.
Unfortunatel y, unlike the .NET environment, in Access you don't have access to the stack, so the above is doing a similar thing the hard way.
Personally , I don't make a distinction between case 1 and case 2, and I "always" implement case 1.
-Tom.
On Sat, 05 Jun 2004 20:50:17 -0700, Tom van Stiphout <to*****@no.spa m.cox.net> wrote:
>On Sun, 06 Jun 2004 02:44:11 GMT, Steve Jorgensen ><no****@no spam.nospam> wrote: > >If you tell us why you need this, perhaps we can respond better. > >Short answer: yes, but you'll need to keep track of the call stack >yourself . > >-Tom. > > >>I'm trying to figure out if there is a way to generate standard error handlers >>that "know" if the calling code has an error handler in effect (On Error Goto >><label> or On Error Resume Next) before deciding how to respond. Does anyone >>know if this is possible.
Basically , I'm trying to reduce the number of standard variations of error handling code block I need to implement in an app that will run and handle errors gracefully and appropriately in the Access run-time environment.
The conflict now, is between 2 standard cases: 1. Any code (except special cases) that will execute in response to a user event must have an error handler that displays an error message (possibly logging the error, etc.) and resumes at the procedure exit point. 2. Any code called by other code should, by default, re-raise the error to calling code, adding its procedure name to the Source to show the call stack.
If you use 2 where you should use 1, the calling code may proceed on the assumptio n that the called code did its job correctly, and this can be a dangerous assumption when it didn't. Furthermore, there can be cases where a procedure may be either case 1 or case 2 in different circumstances.
What I'm hoping to have is an error handling block that knows to display a message and exit if no error handler is in effect in calling code, and to re-raise the error if there is an error handler in effect in the calling code.
Of course, what I wrote above was slightly backward. If you use case 2 when you should use case 1, you crash out of Access. If you use case 1 when you use case 2, the calling code can proceed thinking the called code did its job. About 3/4 of the time, that's OK. Other times, the calling code will error again because something it expected didn't happen, and the user now has to click OK 2 or more times for a single error. A few other times, the procedures could both be handling part of a transactional process (either formally with a database transaction, informally with some sort of deletion roll-back), and data can be left in an invalid state according to the business rules.
I thought of custom the stack idea, but I don't know if code can always be guaranteed to be stacked in the order of execution. For instance, a timer event could fire while a modal form is open (though I avoid timer events when I can). There are probably other ways this could happen that I haven't thought of.
> >I'm not concerned about your Timer example. When the timer ticks, your proc is added to the stack, the code runs and finishes, Pop is called, the stack frame cleans up, and you're back where you were.
But the whole point of the stack is that it's supposed to track whether
the calling code has an error handler. The timer event will be on the stack, possibly after another procedure with an error handler, wit the timer
event was not called by that code. Thus, the error handler will think it should re-raise the error, and crash out of Access when it does. I'm a little concerned about this, but more concerned about other types of out-of-order events I might not have considered.
????
If on entry your Timer proc does the appropriate push/pop then you will know
where you are. Access/VBA are not multithreaded so you can just go with
that.
In all the years I have used the Push/Pop code, with additional bounds checking added, I have never seen it fail, other than due to programmer error (Exit Function without Pop).
So perhaps, the timer is the only possible case?
No, things will work there too as long as you recognize the limitations?
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies
This posting is provided "AS IS" with
no warranties, and confers no rights.
On Sun, 6 Jun 2004 16:19:55 -0700, "Michael \(michka\) Kaplan [MS]"
<mi*****@online .microsoft.com> wrote: >I'm not concerned about your Timer example. When the timer ticks, your >proc is added to the stack, the code runs and finishes, Pop is called, >the stack frame cleans up, and you're back where you were. But the whole point of the stack is that it's supposed to track whetherthe calling code has an error handler. The timer event will be on the stack, possibly after another procedure with an error handler, wit the timer event was not called by that code. Thus, the error handler will think it should re-raise the error, and crash out of Access when it does. I'm a little concerned about this, but more concerned about other types of out-of-order events I might not have considered.
????
If on entry your Timer proc does the appropriate push/pop then you will know where you are. Access/VBA are not multithreaded so you can just go with that.
The order of calling and returning will be correct, but since the timer event
is called by Access, not by the previously called code, if it raises an error,
the previously called code's hanlder will not be invoked. Access will close.
Am I missing something?
>In all the years I have used the Push/Pop code, with additional bounds >checking added, I have never seen it fail, other than due to >programmer error (Exit Function without Pop).
So perhaps, the timer is the only possible case?
No, things will work there too as long as you recognize the limitations?
Well, whether I'm right about the timer event issue or not, it's a special
case that hardly occurs, and I know what to do there - so I guess the custom
call stack idea is sounding solid enough. I'll just go with that.
Thanks for the help all,
- Steve J.
On Sun, 6 Jun 2004 16:19:55 -0700, "Michael \(michka\) Kaplan [MS]"
<mi*****@online .microsoft.com> wrote:
.... ????
If on entry your Timer proc does the appropriate push/pop then you will know where you are. Access/VBA are not multithreaded so you can just go with that.
I just realized what I was thinking of that you might not have been. Access
VBA is not technically multi-threaded, but there are times, such as when a
dialog box is open when timer events (and other events) can fire and be
processed when they were not called by the running code that's waiting for the
dialog. The calling order does not mirror the internal the call stack in such
cases. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Roth |
last post by:
PEP 263 is marked finished in the PEP index, however
I haven't seen the specified Phase 2 in the list of changes
for 2.4 which is when I expected it.
Did phase 2 get cancelled, or is it just not in the
changes document?
John Roth
|
by: tabonni |
last post by:
I want to check each button groups and save the checked value into a 2
dimensional array. But, it doesn't work. Could anyone tell me what's
wrong with my code. My code is as follow:
<html>
<body>
<script language="javascript">
<!--
var temp = new Array(2)
var status = new Array();
|
by: collincm |
last post by:
Hi,
I am trying to optimize a table for inserts. Half of the timeron cost is in
the FK lookup!
These tables for example
CREATE TABLE FOO2(
FOO2_ID INTEGER NOT NULL CONSTRAINT FOO2_PK PRIMARY KEY,
DATA VARCHAR(200) NOT NULL,
LASTTIME TIMESTAMP NOT NULL);
|
by: V_S_H_Satish |
last post by:
Hai Friends
Quite a long time back i ask these questions but everybody send me some
snapshot and functions names but i need select statements for the
following stuff pls help me in this
1. instance name instance status from which table
2. db status and db name fro which table
|
by: John Salerno |
last post by:
My code is below. The main focus would be on the OnStart method. I want
to make sure that a positive integer is entered in the input box. At
first I tried an if/else clause, then switched to try/except. Neither is
perfect yet, but I was wondering which I should try for in the first
place. I figure I need to check for an emptry string, non-numeric
strings (maybe these are the same check), 0 and negative numbers (which
might also fall into...
| |
by: Chandra |
last post by:
How do I programmatically (javascript) check if link is valid in html?
|
by: polycom |
last post by:
Hi,
I am coding a mysql health check script. The logic is to execute the commands (only once)show status,show slave status,show variables and fetch the variable name and value in a hash refer or any other fetch machanism and dynamically use the values to do calculation like the following
threhold values($uptime > 10800) && (Handler_read_rnd_next > 4000) && ((100-(((Handler_read_rnd_next + Handler_read_rnd) / (##Handler_read_rnd_next +...
|
by: Edwin.Madari |
last post by:
updated creature running in its own thread will get you started. try it foryourself, change sleep times per your need.
import os, sys, threading, time
class Creature:
def __init__(self, status):
self.status = status
self.state = 'run'
def start(self):
self.athread = threading.Thread(target=self.print_status)
|
by: alex21 |
last post by:
I'm trying to detect the http status number such as (401 Unauthorized) from a 'WebException' when a WebClient in my code fails.
Public Function DataSources_ValidURL() As Boolean
Dim TestClient As New WebClient()
TestClient.BaseAddress = DataSources_FilePath
Try
TestClient.DownloadString(DataSources_FilePath)
Catch ex As WebException
If ex.Status = 401 Then
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |