473,583 Members | 3,435 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

General methog for passing error information...

I am looking for a way to pass error information back from a COM+ object
that is "better" than incliding a byref argument in every single function...
The session object would be ideal, except for the fact that, well, it is the
session object and my lovewly idea would be broken if the user's browser
doesn't support cookies... But the idea would work like so:

'Stateless COM+ object:
public function DoSomethingReal lyImportant(byv al arg1 as long, byval arg2 as
long) as long
on error goto Panic
DoSomethingReal lyImportant = arg1 / arg2

GetObjectContec t.SetComplete
exit function

Panic:
GetObjectContex t.SetAbort
if err.number = 11 'Divide by zero
Session("MyObje ct.ErrorMessage ") = "Dufus! You can't divide by
zero... yet. The next generation Intel will be able to!"
else
GenerateBSOD()
end if

end function

The nice thing about this is that the error is available to the caller
if/when needed. I can't store it in a local variable in the component, as
the state info is lost at the setcomplete/setabort.

The only thing coming to mind is to include an "optional strError as
string" in EVERY SINGLE FUNCTION, which would be aggravating. I do not want
to use return values for dual purposes, either -- the only time I do that is
when returning a variant that should contain a value, but I use Null to
indicate an error. This let's me know there was an error, but not anything
else...

Any suggestions??

Kurt
Jul 19 '05 #1
2 1704
Have you considered raising the error again so that the caller can trap it?

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Kurt Hill" <ku******@pacbe ll.net> wrote in message
news:e%******** ********@tk2msf tngp13.phx.gbl. ..
I am looking for a way to pass error information back from a COM+ object
that is "better" than incliding a byref argument in every single function... The session object would be ideal, except for the fact that, well, it is the session object and my lovewly idea would be broken if the user's browser
doesn't support cookies... But the idea would work like so:

'Stateless COM+ object:
public function DoSomethingReal lyImportant(byv al arg1 as long, byval arg2 as long) as long
on error goto Panic
DoSomethingReal lyImportant = arg1 / arg2

GetObjectContec t.SetComplete
exit function

Panic:
GetObjectContex t.SetAbort
if err.number = 11 'Divide by zero
Session("MyObje ct.ErrorMessage ") = "Dufus! You can't divide by
zero... yet. The next generation Intel will be able to!"
else
GenerateBSOD()
end if

end function

The nice thing about this is that the error is available to the caller
if/when needed. I can't store it in a local variable in the component, as the state info is lost at the setcomplete/setabort.

The only thing coming to mind is to include an "optional strError as
string" in EVERY SINGLE FUNCTION, which would be aggravating. I do not want to use return values for dual purposes, either -- the only time I do that is when returning a variant that should contain a value, but I use Null to
indicate an error. This let's me know there was an error, but not anything else...

Any suggestions??

Kurt

Jul 19 '05 #2
Mark,

No -- i'd have to use an a "resume next" and then place error trapping code
everywhere, and sometimes I'd rather have the page crash than proceed if I
forgot to check for an error...

And some of the "errors" or not crash-worthy -- they are informational, like
"You can't enter that event because you're too damn old!".

"Mark Schupp" <ms*****@ielear ning.com> wrote in message
news:Og******** ******@TK2MSFTN GP12.phx.gbl...
Have you considered raising the error again so that the caller can trap it?
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Kurt Hill" <ku******@pacbe ll.net> wrote in message
news:e%******** ********@tk2msf tngp13.phx.gbl. ..
I am looking for a way to pass error information back from a COM+ object
that is "better" than incliding a byref argument in every single function...
The session object would be ideal, except for the fact that, well, it is

the
session object and my lovewly idea would be broken if the user's browser
doesn't support cookies... But the idea would work like so:

'Stateless COM+ object:
public function DoSomethingReal lyImportant(byv al arg1 as long, byval

arg2 as
long) as long
on error goto Panic
DoSomethingReal lyImportant = arg1 / arg2

GetObjectContec t.SetComplete
exit function

Panic:
GetObjectContex t.SetAbort
if err.number = 11 'Divide by zero
Session("MyObje ct.ErrorMessage ") = "Dufus! You can't divide by
zero... yet. The next generation Intel will be able to!"
else
GenerateBSOD()
end if

end function

The nice thing about this is that the error is available to the caller
if/when needed. I can't store it in a local variable in the component, as
the state info is lost at the setcomplete/setabort.

The only thing coming to mind is to include an "optional strError as
string" in EVERY SINGLE FUNCTION, which would be aggravating. I do not

want
to use return values for dual purposes, either -- the only time I do

that is
when returning a variant that should contain a value, but I use Null to
indicate an error. This let's me know there was an error, but not

anything
else...

Any suggestions??

Kurt


Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2580
by: stanley j Mroczek | last post by:
Every thing is on one machine, Programs and sql. Sql is up and running(can test with query analyzer). No changes where made! This was working fine. How do you track this error? What network documentation? Nothing shows in the event viewer. where do I start? General network error. Check your network documentation. Description: An...
2
5051
by: SteveS | last post by:
Hello all. This problem is stumping me.... I run a page called "default.aspx". For some reason when I execute this page, I get the error below. It seems to run through the entire code behind just find (including all the sql steps), but after the Page_Load() event I get this error. I really don't know why. Any ideas? ...
7
4736
by: Ken Allen | last post by:
I have a .net client/server application using remoting, and I cannot get the custom exception class to pass from the server to the client. The custom exception is derived from ApplicationException and is defined in an assembly common to the client and server components. The custom class merely defines three (3) constructors -- the null...
14
1823
by: Mr Newbie | last post by:
I am often in the situation where I want to act on the result of a function, but a simple boolean is not enough. For example, I may have a function called isAuthorised ( User, Action ) as ????? OK, this function may return a boolean, and if this is true, then no message back is really required, but if it fails then some supporting message...
7
10236
by: Tim | last post by:
When there is a need to pass some dynamic information between 2 managed assemblies, the "Dictionary object" in Generic form can be used as a method parameter to pass the information. The information that needs to be passed can be stored as Key-Value pairs, and the method signature remains the same. That way, handling future requirements of...
0
12025
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in '/CinemaBookingSystem' Application. -------------------------------------------------------------------------------- ERROR General error Unable to open registry...
0
2176
by: johnkamal | last post by:
Hi, Some times while opening a page, I am getting the following error message, Please help me to rectify the problem. Server Error in '/' Application. General network error. Check your network documentation. Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for...
0
6797
NeoPa
by: NeoPa | last post by:
Table of Contents - Previous Chapter - ----------------------------------------------------------------------------------------------- 3) General Tips. The first and most important tip is always to work with a compiled project. Many of the problems you're likely to come across are identified during the compile process. Compile from the...
12
11047
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed!...
0
7893
marktang
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...
0
8172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7928
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...
0
8188
tracyyun
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...
0
6574
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3839
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2326
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
1
1422
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.