473,508 Members | 2,074 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 DoSomethingReallyImportant(byval arg1 as long, byval arg2 as
long) as long
on error goto Panic
DoSomethingReallyImportant = arg1 / arg2

GetObjectContect.SetComplete
exit function

Panic:
GetObjectContext.SetAbort
if err.number = 11 'Divide by zero
Session("MyObject.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 1697
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******@pacbell.net> wrote in message
news:e%****************@tk2msftngp13.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 DoSomethingReallyImportant(byval arg1 as long, byval arg2 as long) as long
on error goto Panic
DoSomethingReallyImportant = arg1 / arg2

GetObjectContect.SetComplete
exit function

Panic:
GetObjectContext.SetAbort
if err.number = 11 'Divide by zero
Session("MyObject.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*****@ielearning.com> wrote in message
news:Og**************@TK2MSFTNGP12.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******@pacbell.net> wrote in message
news:e%****************@tk2msftngp13.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 DoSomethingReallyImportant(byval arg1 as long, byval

arg2 as
long) as long
on error goto Panic
DoSomethingReallyImportant = arg1 / arg2

GetObjectContect.SetComplete
exit function

Panic:
GetObjectContext.SetAbort
if err.number = 11 'Divide by zero
Session("MyObject.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
2564
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...
2
5039
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...
7
4732
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...
14
1808
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 ?????...
7
10231
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...
0
12004
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...
0
2159
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...
0
6787
NeoPa
by: NeoPa | last post by:
Table of Contents - Previous Chapter - ----------------------------------------------------------------------------------------------- 3) General Tips. The first and most important tip is...
12
11007
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....
0
7225
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,...
0
7124
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...
0
7385
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...
0
5629
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,...
0
4707
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...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1558
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 ...
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.